Monday, March 12, 2012

List of stored procedures with permission for executing for user

I have user XY in SQL 05. I would like to find all stored procedures, where user XY has permission for executing. Is there any way to find it than look in every stored procedure?

Thanks for tips

If you want to get the list of stored procedures , on which specific database user ('XY') has EXECUTE permission explicitly granted , consider the following query:

Code Snippet

SELECT [name]

FROM sys.objects obj

INNER JOIN sys.database_permissions dp ON dp.major_id = obj.object_id

WHERE obj.[type] = 'P' -- stored procedure

AND dp.permission_name = 'EXECUTE'

AND dp.state IN ('G', 'W') -- GRANT or GRANT WITH GRANT

AND dp.grantee_principal_id =

(SELECT principal_id FROM sys.database_principals WHERE [name] = 'XY')

But you should be aware that here you deal only with explicitly granted permissions, not effective permissions of the user.|||

thanks a lot|||

is there any way to do this with sql server 2000?

No comments:

Post a Comment