The SELECT permission has not been granted on 'sys.sql_logins' for the 'master' database. You must be a member of the 'loginmanager' role to access this system view. code example

Example: The SELECT permission has not been granted on 'sys.sql_logins' for the 'master' database. You must be a member of the 'loginmanager' role to access this system view.

select dp.name as db_role, dp2.name as db_user
from sys.database_role_members drm
join sys.database_principals dp on (drm.role_principal_id = dp.principal_id)
join sys.database_principals dp2 on (drm.member_principal_id = dp2.principal_id)
order by dp.name

Tags:

Sql Example