Permission List in SQL SERVER 2005
Script
select b.name,c.name,
user_name(a.grantee_principal_id) as UserName,a.permission_name,
case a.state
when 'W' then 'With Grant Option'
when 'G' then 'Grant'
When 'D' then 'Deny'
Else ''
end as PermissionType
from sys.database_permissions a,sys.all_objects b,sys.schemas c
where b.object_id=a.major_id
and a.grantee_principal_id<>0
and a.grantee_principal_id<>2
and b.schema_id=c.schema_id
No comments:
Post a Comment