Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Synchronize the DB user SID with the Login SID

By Peter Petrov,

If you attach a DB on an SQL Server different from the SQL Server where the DB was initially created, you will usually come up with a situation where a login will be a DB user however, you cannot see this through the login properties screen. That happens because the name of the login exists in the database as a DB user but the sid in the DB is different from the sid of the login. This script will fix the problem in a "quick and dirty" fashion. Just change [ATTACHED-DB] with the name of the DB and 'DBUSER-TO-SYNC' with the problematic DB user/login and run it. Of course, the login and the DB user must exist...

Total article views: 1330 | Views in the last 30 days: 0
 
Related Articles
FORUM

logins

logins

FORUM

Logins

Delete logins

FORUM

Logins

Logins

FORUM

Login locked

Login locked

FORUM

user,login

user,login

 
Contribute