[SQL Server]ユーザーへのロール割り当て一覧

ユーザーに割り当てたロールの一覧を表示するSQL

コード

select
	mprincipals.name as member_name,
	mprincipals.type_desc as member_type,
	rprincipals.name as role_name
from sys.database_role_members as roles
inner join sys.database_principals as rprincipals on roles.role_principal_id=rprincipals.principal_id
inner join sys.database_principals as mprincipals on roles.member_principal_id=mprincipals.principal_id

コメントを残す