Displaying information about roles

Table 4-2 lists the system procedures and functions to use to find information about roles.

Table 4-2: Finding information about roles

To display information about

Use

See

The role ID of a role name

role_id system function

“Finding role IDs and names”

The role name of a role ID

role_name system function

“Finding role IDs and names”

System roles

show_role system function

“Viewing active system roles”

Role hierarchies and roles that have been granted to a user or users

sp_displayroles system procedure

“Displaying a role hierarchy”

Whether one role contains another role in a role hierarchy

role_contain system function

“Viewing user roles in a hierarchy”

Whether two roles are mutually exclusive

mut_excl_roles system function

“Determining mutual exclusivity”

Roles that are active for the current session

sp_activeroles system procedure

“Determining role activation”

Whether you have activated the correct role to execute a procedure

has_role system function

“Checking for roles in stored procedures”

Logins, including roles that have been granted

sp_displaylogin system procedure

“Getting information about login accounts”

Permissions for a user, group, or role

sp_helprotect system procedure

“Reporting on permissions”