I am trying to find the permissions for a specific user for a specific database on SQL Server 2008 R2.
My database is testDB
and name of user is testUser
.
This is the script I am using
SELECT
dp.type_desc AS principal_type_desc,
dbp.class_desc,
OBJECT_NAME(dbp.major_id) AS object_name,
dbp.permission_name,
dbp.state_desc AS permission_state_desc
FROM
sys.database_permissions dbp
INNER JOIN
sys.database_principals dp ON dbp.grantee_principal_id = dp.principal_id
WHERE
USER_NAME(dbp.grantee_principal_id) = 'TestUser'
Not sure how to get permissions for a specific user in a specific database