Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View all securables for roles in SQL Server database?

How can we show all the securable that is added in any particular role in script?

like image 219
sanjeev40084 Avatar asked Jan 07 '10 16:01

sanjeev40084


People also ask

How do I get a list of user roles in SQL Server?

To find all the role assignments to users in SQL Server database, you can use the following query. SELECT r.name role_principal_name, m.name AS member_principal_name FROM sys. database_role_members rm JOIN sys. database_principals r ON rm.

How do I view privileges of a role in SQL?

Querying DBA/USER Privilege Views For example, a DBA wishing to view all system privileges granted to all users would issue the following query: SELECT * FROM DBA_SYS_PRIVS; The DBA_SYS_PRIVS view contains three columns of data: GRANTEE is the name, role, or user that was assigned the privilege.

How do I check permissions of a role?

In the navigation pane, click ACCESS CONTROL. In the lower navigation pane, click Roles. In the display pane, the roles are listed. Select the role whose permissions you want to view.

How can check public role permissions in SQL Server?

Given the fact that there are server-level roles and database-level roles, let us explore the server-level permissions assigned to the public role. SELECT sp. state_desc as "Permission State", sp. permission_name as "Permission", sl.name "Principal Name",sp.


1 Answers

SELECT
    OBJECT_NAME(major_id), USER_NAME(grantee_principal_id), permission_name
FROM
    sys.database_permissions p
WHERE
    p.class = 1 AND
    OBJECTPROPERTY(major_id, 'IsMSSHipped') = 0
ORDER BY
    OBJECT_NAME(major_id), USER_NAME(grantee_principal_id), permission_name
like image 199
gbn Avatar answered Nov 14 '22 22:11

gbn