SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 User permissions
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Constraint Violating Yak Guru

498 Posts

Posted - 06/10/2013 :  17:10:25  Show Profile  Reply with Quote

Is there any query that we can run to get user permissions on database, table, view, sp level in a given database?


James K
Flowing Fount of Yak Knowledge

3865 Posts

Posted - 06/10/2013 :  17:40:03  Show Profile  Reply with Quote
See if one of these functions will do what you want:
Go to Top of Page

Constraint Violating Yak Guru

352 Posts

Posted - 06/18/2013 :  15:29:09  Show Profile  Reply with Quote
I found this a while back:
SELECT PER.class_desc                               AS PermClass
      ,PER.[type]                                   AS PermType
      ,ISNULL(SCH.name + N'.' + OBJ.name,DB_NAME()) AS ObjectName
      ,ISNULL(COL.Name, N'')                        AS ColumnName
      ,PRC.name                                     AS PrincName
      ,PRC.type_desc                                AS PrincType      
      ,GRT.name                                     AS GrantorName
      ,PER.permission_name                          AS PermName
      ,PER.state_desc                               AS PermState      
FROM sys.database_permissions           PER
     INNER JOIN sys.database_principals PRC ON PER.grantee_principal_id = PRC.principal_id
     INNER JOIN sys.database_principals GRT ON PER.grantor_principal_id = GRT.principal_id
     LEFT JOIN sys.objects              OBJ ON PER.major_id = OBJ.object_id
     LEFT JOIN sys.schemas              SCH ON OBJ.schema_id = SCH.schema_id
     LEFT JOIN sys.columns              COL ON PER.major_id = COL.object_id AND PER.minor_id = COL.column_id
WHERE PER.major_id >= 0
ORDER BY PermClass

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000