I had a task where I had to list all the permission of a specific user on the database . The following script came to the rescue
SELECT dppriper USER_NAME(dppriper.grantee_principal_id) AS [UserName], .type_desc AS principal_type_desc, .class_desc, OBJECT_NAME (dppriper.major_id) AS object_name, .permission_name, .state_desc AS permission_state_desc
FROM sys.database_permissions dppriper
INNER JOIN sys.database_principals dppri
ON dppriper.grantee_principal_id = dppri.principal_id
WHERE
--dppriper.permission_name = 'EXECUTE'
USER_NAME(dppriper.grantee_principal_id) = 'myuser'
--**replace the myuser with the user we are looking for
--**If we want to find only the stored procedures that the user has perission on comment out the clause in the above query.
No comments:
Post a Comment