Server Login Database User Mapping

  • Hi,

    Please let me know where to find information regarding User-Login Mapping inside an instance of SQL Server 2005. As part of a SQL Server Consolidation I am moving dbs from n Sql Server instances and also transferring logins using sp_heaxadecimal and sp_help_revlogin scripts. I want to make sure that the original User-Login mapping is intact.

  • Hello,

    The DB level Catalogue View sys.database_principals will give you details regarding DB Users (per DB). This can be jopined with the Server level (Login) information contained in sys.server_principals

    Regards,

    John Marsh

    www.sql.lu
    SQL Server Luxembourg User Group

  • What to join these tables on? How to find the User-Login Mapping from these tables?

    TIA

  • Hello Again,

    sys.server_principals gives you the Server Logins and sys.database_principals gives you the DB Users in the selected DB.

    Joining on the sid gives you the mapping (for one DB) e.g. Select * From sys.server_principals ssp Inner Join sys.database_principals sdb On (sdb.sid = ssp.sid)

    Regards,

    John Marsh

    www.sql.lu
    SQL Server Luxembourg User Group

  • Hello Sir,

    Yes, that works Precisely .

    Thanks a lot 🙂

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply