Surf 11 » Fixing SQL Server Users after Backup Restore

Finding the best waves on the web.

Often when you restore a backup from SQL server you run into funky problems with users. Suppose you have login cfusion and you restore a database from another server that also had user called cfusion you can't properly use this login, and you might get the error:

Error 15023: User or role 'cfusion' already exists in the current database.

To fix this I ran:

EXEC sp_change_users_login 'Auto_Fix', 'cfusion', NULL, 'password'

And it worked like a charm.

Related Entries

Email: (optional, not displayed on site)
   Subscribe to this thread
Comments: (html will be escaped)

Archives   Tags   Contact