Find User/Role Permission on an Object  

Posted by ReelTym

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

This entry was posted on Wednesday, April 23, 2014 and is filed under . You can leave a response and follow any responses to this entry through the Subscribe to: Post Comments (Atom) .

0 comments