Tara-1044200
SSCoach
Points: 15951
More actions
September 9, 2009 at 9:57 am
#204501
SELECT * FROM sys.server_principals
above query gives list of all users on a server but how would i filter by database. I need list of users only in a particular database.
K. Brian Kelley
SSC Guru
Points: 114703
September 9, 2009 at 10:44 am
#1051277
SELECT * FROM database.sys.database_principals
If you need to match that up with logins...
SELECT sp.name, dp.name
FROM database.sys.database_principals dp
INNER JOIN sys.server_principals sp
ON dp.sid = sp.sid
K. Brian Kelley@kbriankelley
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply