Skip to content

Instantly share code, notes, and snippets.

@benrobot
Created August 22, 2023 21:44
Show Gist options
  • Save benrobot/759084ed8f3763893b40d66211b86049 to your computer and use it in GitHub Desktop.
Save benrobot/759084ed8f3763893b40d66211b86049 to your computer and use it in GitHub Desktop.
Spell out permissions explicitly granted at the database level
USE MyDatabaseName
GO
SELECT CONCAT(
USER_NAME(grantee_principal_id)
,' is '
,state_desc
,'ED permission to '
,[permission_name]
,' on object '
,USER_NAME(grantor_principal_id)
,'.'
,OBJECT_NAME(major_id)
) AS [Meaning]
FROM sys.database_permissions
WHERE USER_NAME(grantee_principal_id) <> 'public'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment