Monday, March 12, 2012

How to list sp perms?

I query information_schema.table_privileges for permissions to tables
What do I query to get list of all permsissions grants on stored procedures
and udf's?
tia
chrisChris
In SQL Server 2005, you can use the Has_Perms_By_Name() function
(http://msdn2.microsoft.com/en-us/library/ms189802.aspx).

> For example, I would like to list all stored procedures which a role has
> execute permission for.
This is an example of usage:
SELECT o.SchemaAndName,
has_perms_by_name(o.SchemaAndName, 'OBJECT', 'EXECUTE')
FROM (SELECT name, SCHEMA_NAME(schema_id) AS [schema],
SCHEMA_NAME(schema_id)+'.'+name AS SchemaAndName
FROM sys.objects
WHERE type = 'P') AS o
"Chris" <Chris@.discussions.microsoft.com> wrote in message
news:3303F0F9-082F-48B1-AD48-0406FDB03761@.microsoft.com...
> I query information_schema.table_privileges for permissions to tables
> What do I query to get list of all permsissions grants on stored
> procedures
> and udf's?
> tia
> chris

No comments:

Post a Comment