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>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s