1. Attached an updated version of the instance-wide script, which takes into consideration the following scenarios:

    1. Orphan user is “dbo”, which means database has no owner -> Sets the owner to the sa login.
    2. Orphan user has a matching login -> Generates ALTER USER command to match the login.
    3. Orphan user has no matching login -> Generates DROP USER command, plus ALTER SCHEMA to move ownership of any owned schemas to dbo.


Leave a Reply to T-SQL Tuesday 138 – sp_help_revlogin is dead, long live sp_help_revlogin2 – Eitan Blumin's Blog Cancel 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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

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