:::: MENU ::::

Database roles for SQL Server databases

  • Nov 11 / 2008
  • 0
dbDigger, Security and Permissions, T-SQL Scripts

Database roles for SQL Server databases

A login may be member of a Server role or database role. Member of database roles have permissions for that specific SQL Server database. Following script will show that which SQL Server login is member of a particular database role.

 
USE DBName  
 GO  
 SELECT  
 p.name, p.type_desc, pp.name, pp.type_desc, pp.is_fixed_role  
 FROM sys.database_role_members roles  
 JOIN sys.database_principals p ON roles.member_principal_id = p.principal_id  
 JOIN sys.database_principals pp ON roles.role_principal_id = pp.principal_id  
 GO  
Consult us to explore the Databases. Contact us