SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Server Login Database User Mapping


Server Login Database User Mapping

Author
Message
skyw
skyw
Old Hand
Old Hand (326 reputation)Old Hand (326 reputation)Old Hand (326 reputation)Old Hand (326 reputation)Old Hand (326 reputation)Old Hand (326 reputation)Old Hand (326 reputation)Old Hand (326 reputation)

Group: General Forum Members
Points: 326 Visits: 171
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.
John H Marsh
John H Marsh
Hall of Fame
Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)

Group: General Forum Members
Points: 3449 Visits: 1468
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
skyw
skyw
Old Hand
Old Hand (326 reputation)Old Hand (326 reputation)Old Hand (326 reputation)Old Hand (326 reputation)Old Hand (326 reputation)Old Hand (326 reputation)Old Hand (326 reputation)Old Hand (326 reputation)

Group: General Forum Members
Points: 326 Visits: 171
What to join these tables on? How to find the User-Login Mapping from these tables?

TIA
John H Marsh
John H Marsh
Hall of Fame
Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)

Group: General Forum Members
Points: 3449 Visits: 1468
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
skyw
skyw
Old Hand
Old Hand (326 reputation)Old Hand (326 reputation)Old Hand (326 reputation)Old Hand (326 reputation)Old Hand (326 reputation)Old Hand (326 reputation)Old Hand (326 reputation)Old Hand (326 reputation)

Group: General Forum Members
Points: 326 Visits: 171
Hello Sir,

Yes, that works Precisely .


Thanks a lot Smile
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search