sp_change_users_login

After you restore a database from a different instance, you may receive login errors when trying to access the restored database. To resolve this, run sp_change_users_login to check for orphaned users. for example:

> sp_change_users_login 'report'

if there are orphaned users listed, run either one of this to resolve:

> sp_change_users 'auto_fix', 'user'

> sp_change_users 'update_one', 'user', 'login'

refer to BOL for more information about this stored procedure.

.

No comments: