declare
@SchemaName sysname = 'COMPANY_STRUCTURE',
@TableName sysname = 'SUPP_SUPPLIER',
@UserOrRole sysname = 'ECT_Role'
declare @perms table
(
table_qualifier sysname,
table_owner sysname,
table_name sysname,
grantor sysname,
grantee sysname,
privilege sysname,
is_grantable sysname
)
insert into @perms
exec sp_table_privileges
@table_owner = @SchemaName,
@table_name = @TableName
select *
from @perms
where grantee = @UserOrRole
order by grantee
@SchemaName sysname = 'COMPANY_STRUCTURE',
@TableName sysname = 'SUPP_SUPPLIER',
@UserOrRole sysname = 'ECT_Role'
declare @perms table
(
table_qualifier sysname,
table_owner sysname,
table_name sysname,
grantor sysname,
grantee sysname,
privilege sysname,
is_grantable sysname
)
insert into @perms
exec sp_table_privileges
@table_owner = @SchemaName,
@table_name = @TableName
select *
from @perms
where grantee = @UserOrRole
order by grantee