• Tom Brown (9/4/2012)


    Orphaned users are easy to fix:

    -- show users not mapped to a login

    EXEC sp_change_users_login 'Report'

    -- map database user OrphanedUser to Login OrphanedUser

    EXEC sp_change_users_login @Action='Update_One', @UserNamePattern='OrphanedUser' , @LoginName='OrphanedUser'

    Just remember, sp_change_users_login:

    Maps an existing database user to a SQL Server login. This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use ALTER USER instead.