Thursday, July 25, 2013

Fix Microsoft SQL missing login name after db copy/move

To fix the missing login name, just execute this

EXEC sp_change_users_login 'UPDATE_ONE','Annie','Annie'

replace Annie with the name of the user

To find out the list of broken / orphaned users, you can execute this

EXEC sp_change_users_login 'REPORT'


On SQL 2005 and above, this is the query to fix

use dbname;
EXEC sp_change_users_login 'Auto_Fix', 'username', null, 'password'

No comments: