Thursday, November 26, 2015

SCRIPT to FIND Object Level Permissions.


USE DBNAME

select USER_NAME(p.grantee_principal_id) AS principal_name,
dp.type_desc AS principal_type_desc,
p.class_desc,
OBJECT_NAME(p.major_id) AS object_name,
p.permission_name,
p.state_desc AS permission_state_desc
from sys.database_permissions p
inner JOIN sys.database_principals dp
on p.grantee_principal_id = dp.principal_id

--where p.grantee_principal_id=11


--select USER_ID('GROUP\ACC_S671A0004_Complyman_Admin_RW')

--select USER_NAME(grantee_principal_id),grantee_principal_id from sys.database_permissions

No comments:

Post a Comment