SQL Server: T-SQL Script to find object level permission of specific table
MSSQL, T-SQL Scripts database access, SQL server, table level permission 0
(0)
Below query can be used to find object level permission of specific table in SQL Server.
use <DB> -- replace database name here
go
select @@servername as Server, db_name() as 'Database', su.name as 'UserName', so.name as Object, permission_name as Permission from sys.database_permissions dp
join sys.sysusers su on grantee_principal_id = uid
join sys.sysobjects so on major_id = id
where so.name='<Table_Name>' -- replace table name here
Example:
use Dbalyfe
go
select @@servername as Server, db_name() as 'Database', su.name as 'UserName', so.name as Object, permission_name as Permission from sys.database_permissions dp
join sys.sysusers su on grantee_principal_id = uid
join sys.sysobjects so on major_id = id
where so.name='student'
Sample Output:

How useful was this post?
Click on a star to rate it!
Average rating 0 / 5. Vote count: 0
No votes so far! Be the first to rate this post.