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
 General SQL Server Forums
 New to SQL Server Administration
 sql server database roles

Author  Topic 

tkothari
Starting Member

3 Posts

Posted - 2012-09-10 : 11:37:34
I need to find out about 1 database only, all the database user and their roles, group by groupname

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-09-10 : 12:33:05
have a look at sys.database_principals catalog view

http://msdn.microsoft.com/en-us/library/ms187328.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

tkothari
Starting Member

3 Posts

Posted - 2012-09-10 : 13:31:15
quote:
Originally posted by visakh16

have a look at sys.database_principals catalog view

http://msdn.microsoft.com/en-us/library/ms187328.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/






Can you please help me with the how to write script about this?
Go to Top of Page

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2012-09-17 : 18:19:51
[CODE]select
roles.name,
members.name
from
sys.database_role_members rm
inner join
sys.database_principals roles
on rm.role_principal_id = roles.principal_id
inner join
sys.database_principals members
on rm.member_principal_id = members.principal_id
order by
roles.name,
members.name[/CODE]

=================================================
We are far more concerned about the desecration of the flag than we are about the desecration of our land. -Wendell Berry
Go to Top of Page
   

- Advertisement -