Technical Article

SQL 2005 - List Permission

,

sp_helprotect : BOL Says - Returns a report that has information about user permissions for an object, or statement permissions, in the current database.

It will give you list of all the database objects. If you want only Stored Procrdure or/ and Functions or/and Tables or/and Views you can use following script with little variation as per your requirement.

SELECT name,
 user_name(grantee_principal_id) as grantee,
 user_name(grantor_principal_id) as grantor ,
 Permission_name ,
 State_desc,
 o.Type_desc
FROM sys.database_permissions dp JOIN sys.objects o on dp.major_id = o.object_id
WHERE class = 1 
AND o.type in ('U','P') -- U -USER_TABLE, P-SQL_STORED_PROCEDURE , V-- View, Fn-- Functions
AND dp.type in ('SL','IN','UP','EX') -- SL- Select, IN - Insert, Up - Update ,'Ex - Execute
ORDER BY name

Rate

3.38 (8)

You rated this post out of 5. Change rating

Share

Share

Rate

3.38 (8)

You rated this post out of 5. Change rating