SQL Server All object permission

SQL SERVER all object permission konulu makalemiz de veritabanı bazlı objelere (tablo,view vb ..) yetkilerini görmek ve hangi tablomuzda hangi yetkinin var olduğunu ve bu yetkili kullanıcı kim sorularını aşağıdaki t-sql ile cevaplayabiliriz.

SELECT 
 USER_NAME(grantee_principal_id) AS 'User'
 , state_desc AS 'Permission'
 , permission_name AS 'Action'
 , CASE class
 WHEN 0 THEN 'Database::' + DB_NAME()
 WHEN 1 THEN OBJECT_NAME(major_id)
 WHEN 3 THEN 'Schema::' + SCHEMA_NAME(major_id) END AS 'Securable',dr.authentication_type_desc
FROM sys.database_permissions dp
join sys.database_principals as dr on dp.grantee_principal_id=dr.principal_id
WHERE class IN (0, 1, 3)
AND minor_id = 0 
and USER_NAME(grantee_principal_id) not like 'public'

 

Loading