Friday, April 9, 2010

Fixing Orphan Users

You all might already known that if we have orphan users in the Database then using the stored Proc sp_change_users_login we can map the user to a Sql Login.
But According to Books Online, this feature will depreciated in the future.

So you guys must be wondering ,then how are we going to fix Orphan user Problem.
Well Here is the Solution.

Alter User UserName
With Login = LoginName


Replace the userName and LoginName accordingly with the orphaned user
and the existing login.

The advantage of using this method over sp_change_users_login is that
ALTER USER WITH LOGIN supports both SQL Server and Windows
logins where as sp_change_users_login works only for SQL Server
logins


I have picked up this tip from Laurentis Blog

http://blogs.msdn.com/lcris/

His Blog is an excellent resource for topics related to Sql Server Security

No comments:

Post a Comment