Ever restored a database in SQL Server. And then had all this disconnected logins hanging around. Logins in the database that got restored, but have no SQL Server login name associated with them. Fear no more, here's the help:
sp_change_users_login
And here's how to use it:
sp_change_users_login @Action='Update_One', @UserNamePattern='dbuser', @LoginName='sysuser', @Password=Null
This will reconnect the database user dbuser with the login name in the system sysuser. Normally both user names are the same.
Enjoy
No comments:
Post a Comment