How to get users who has execute permission for a specific sp in sql server? -


how users/ user groups/ user roles having execute permission on specific stored procedure in ms sql server 2008 r2.

running profiler trace on ssms activity reveals ssms gathers data stored procedure properties window following query, customise purposes (note values last 2 parameters need customised consider procedure you're interested in):

exec sp_executesql n'select grantee_principal.name [grantee], case grantee_principal.type when ''r'' 3 when ''a'' 4 else 2 end - case ''database'' when  ''database'' 0 else 2 end [granteetype] sys.all_objects sp inner join sys.database_permissions prmssn on prmssn.major_id=sp.object_id , prmssn.minor_id=0 , prmssn.class=1 inner join sys.database_principals grantee_principal on grantee_principal.principal_id = prmssn.grantee_principal_id (sp.type = @_msparam_0 or sp.type = @_msparam_1 or sp.type=@_msparam_2) and(sp.name=@_msparam_3 , schema_name(sp.schema_id)=@_msparam_4)', n'@_msparam_0 nvarchar(4000),@_msparam_1 nvarchar(4000),@_msparam_2 nvarchar(4000),@_msparam_3 nvarchar(4000),@_msparam_4 nvarchar(4000)', @_msparam_0=n'p',@_msparam_1=n'rf',@_msparam_2=n'pc',@_msparam_3=n'~procedure name~',@_msparam_4=n'~procedure schema~' 

it's worth noting doesn't include users implicitly have execute permissions because of high-level role memberships (by virtue of being members of sysadmin server role, example).

neither expand role memberships individual users.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -