1USE master
2GO
3SELECT DP1.name AS DatabaseRoleName,
4 isnull (DP2.name, 'No members') AS DatabaseUserName
5 FROM sys.database_role_members AS DRM
6 RIGHT OUTER JOIN sys.database_principals AS DP1
7 ON DRM.role_principal_id = DP1.principal_id
8 LEFT OUTER JOIN sys.database_principals AS DP2
9 ON DRM.member_principal_id = DP2.principal_id
10WHERE DP1.type = 'R'
11ORDER BY DP1.name;