A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  special characters  sybase-tech-blog


Category: ASE: Stored Procedures: Users, Roles und Permissions

sp_displayroles

The system stored procedure sp_displayroles lists all roles which have been granted to a role (role_name) or login (login_name) using the grant role command. sp_displayroles can be executed by every user, in order to check which roles have been assigned to it. The sa (system administrator) can use sp_displayroles to also list roles which have been granted to other users. sp_displayroles is stored in the system database sybsystemprocs.

Syntax of the Stored Procedure sp_displayroles

sp_displayroles [role_name|login_name, [option]]

Parameter role_name and login_name of the Stored Procedure sp_activeroles

Executing sp_displayrole with the parameter role_name or login_name displays the information attached to the role or login. Using both parameters, displays all directly granted roles respectively.

Parameter option of the Stored Procedure sp_displayroles

The parameter option of the stored procedure sp_displayroles provides the following three options:

  • expand_up Displays the hierarchy tree based on the parent level.
  • expand_down Display the hierarchy tree based on the child level.
  • display_info Displays security relevant login information like for example password hardness or the lock status of the role_name or login_name provided.

Examples for using sp_displayroles

    sp_displayroles appl_admin
    go
    
    Role Name
    ------------------------------
    sso_role
    mon_role
    sp_displayroles appl_admin, "expand_up"
    go
    
    Role Name                      Parent Role Name               Level  
    ------------------------------ ------------------------------ ------ 
    mon_role                       NULL                                0 
    sso_role                       NULL                                0
    sp_displayroles tlm_admin, "expand_down"
    go
    
    Role Name                      Parent Role Name               Level  
    ------------------------------ ------------------------------ ------ 
    mon_role                       NULL                                1 
    sso_role                       NULL                                1

Related commands, functions and stored procedures

See also:

System Procedures.