• No categories


I’m Attending


SQL Server Backup and Restore Across Server Username Fix

Posted in: Programming by Steve on August 22, 2012

I run into this a lot while deploying new fixes. If you have a production and a stage environment, before deploying to production, you should backup and restore your database to the staging database to do all your UAT. However, if your usernames are the same, then you may run into an issue where SQL has an "orphaned" user that cannot be associated to the database (

USE [database_name]
exec sp_change_users_login "auto_fix", "username";

That should get you back up and running.