Wednesday, 16 September 2009

Reassociating user logins

When restoring databases from backups on a developer machine you will probably need to create Logins for the application you are working on. The Logins will correspond to the Users used by the application but because the original Logins were created on a different server the Logins created on your development machine won't be correctly associated with the Users in the database.

To reassociate a Login with a database User run the following SQL:

EXEC sp_change_users_login 'Update_One', '[user name here]', '[login name here]'

More information and options here: http://msdn.microsoft.com/en-us/library/ms174378.aspx

0 comments:

Post a Comment

By all means leave a comment. I may not be able to get back to you as quickly as I'd like but I'll do my very best.