Home All Groups Group Topic Archive Search About

SQL Server 2005 SSMS List Role Permission



Author
27 Nov 2008 3:50 PM
Joe K.
I created a role within a SQL Server 2005 database that I assigned
permission to tables and stored procedures.  How can I display the
permissions associated with this role?

Please help me with this issue.

Author
27 Nov 2008 10:40 PM
Mohit K. Gupta
Try ..

DECLARE @PrincipalName VARCHAR(255)

SET @PrincipalName = 'DatabaseRoleName'

SELECT t.name            AS ObjectName,
       t.type            AS OjbectType,
       p.permission_name AS PermissionName,
       p.state           AS PermissionState
  FROM sys.database_permissions p,
       sys.tables t
WHERE grantee_principal_id = ( SELECT principal_id
                                  FROM sys.database_principals
                                 WHERE name like @PrincipalName)
   AND t.object_id = p.major_id

Thanks.
--
Mohit K. Gupta
B.Sc. CS, Minor Japanese
MCITP: Database Administrator
MCTS: SQL Server 2005
http://sqllearnings.blogspot.com/


Show quoteHide quote
"Joe K." wrote:

>
> I created a role within a SQL Server 2005 database that I assigned
> permission to tables and stored procedures.  How can I display the
> permissions associated with this role?
>
> Please help me with this issue.
>
Are all your drivers up to date? click for free checkup

Author
1 Dec 2008 5:53 AM
Uri Dimant
Joe
SELECT
dp.Class,
dps1.Name As Grantee,
dps2.Name As Grantor,
so.Name,
so.Type,
dp.Permission_Name,
dp.State_Desc
FROM sys.database_permissions AS dp
JOIN Sys.Database_Principals dps1
ON dp.grantee_Principal_ID = dps1.Principal_ID
JOIN Sys.Database_Principals dps2
ON dp.grantor_Principal_ID = dps2.Principal_ID
    JOIN sys.objects AS so
    ON dp.major_id = so.object_id
    -----WHERE so.Name = 'storedprocedurename'


Show quoteHide quote
"Joe K." <Joe K*@discussions.microsoft.com> wrote in message
news:153FDE41-A5C9-4114-8D26-63DB14D9E2B8@microsoft.com...
>
> I created a role within a SQL Server 2005 database that I assigned
> permission to tables and stored procedures.  How can I display the
> permissions associated with this role?
>
> Please help me with this issue.
>

Bookmark and Share