Wednesday, May 14, 2008

Fixing a DB User After a MS SQL Server Restore

Situation: After running a database restore a database user is no longer linked to a SQL Server login.

Solution: Run the following:
   1: USE [%DB NAME%]


   2: EXEC sp_change_users_login 'Auto_Fix','%USERNAME%'


   3: GO






Details:

MS Technet: sp_change_users_login (Transact-SQL)

1 comment:

R said...

The orphaned account issue. We deal with this all the time. Never thought of blogging about it. Good information. :D