One Comment on “Troubleshooting Orphaned Users SQL Server. How to list them out and fix them.”

  1. Hi Vasu,

    Just a quick reply here.

    sp_change_users_login stored porcesure is going to be depreceated in future versions which was suppose to happen from SQL 2008 but somehow still it still worksin SQL 2008.So it is better stop using sp_change_users_login.Instead use the following query to get a list of orphaned users

    1 select p.name, sid from sys.database_principals p where p.sid not in (select sid from sys.server_principals) and type = ‘S’ and name’guest’

    And use ‘Alter User’ command to fix the orphaned users.

    1 Alter User OrphanedUser with login=ExistingLogin

Leave a Reply

Your email address will not be published. Required fields are marked *