tsql - Get list of all database users with specified role -


I want to get the list of all database users with the specified role. The role is a parameter for the stored procedure or function.

Some names have a statement with the username and its role.

  +======================= | User Name | Role | + =======================  

MS SQL Server 2008

< P>

In SQL 2005 and 2008, this information is most easily accessed in two catalog views.

With this query you are looking at the information again.

  Select rp.name as database, as mp.name as database_user from sys.database_role_members drm join sys.database_principals at RP (drm.role_principal_id = rp.principal_id) in sys.database_principals Join on the MP3 (drm.member_principal_id = mp.principal_id)  

Comments

Popular posts from this blog

paypal - How to know the URL referrer in PHP? -

oauth - Facebook OAuth2 Logout does not remove fb_ cookie -

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -