Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 how to list database users and roles

Author  Topic 

rudba
Constraint Violating Yak Guru

415 Posts

Posted - 2010-08-25 : 10:26:59
Is there SQL query to list all database users and server roles? I have SQL Server 2008.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-08-25 : 10:34:44
Duplicate of http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=149277

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

rudba
Constraint Violating Yak Guru

415 Posts

Posted - 2010-08-25 : 11:01:45
Sorry for duplicate post.

any body have idea???
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2010-08-25 : 11:40:21
try this:

SELECT
dbU.[name] AS [user]
, dbGp.[name] AS [Group]
FROM
sys.database_role_members AS dbRM
JOIN sys.database_principals AS dbU ON dbU.[principal_id] = dbRM.[member_principal_id]
JOIN sys.database_principals AS dbGp ON dbGp.[principal_id] = dbRM.[role_principal_id]



Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page
   

- Advertisement -