Fixing an “orphaned” SQL Server User

If you restore a database from another SQL Server instance, the user in this database will point to a login that doesn’t exists in this instance. The usual to tip to fix this is to use sp_change_users_login, but I think the simplest is to use the ALTER USER statement:

ALTER USER <user> WITH LOGIN=<login>

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.