show_role

Displays the currently active system-defined roles of the current login.

Syntax

show_role()

Examples

Usage

  • show_role, a system function, returns the login’s current active system-defined roles, if any (sa_role, sso_role, oper_role, or replication_role). If the login has no roles, show_role returns NULL.

  • When a Database Owner invokes show_role after using setuser, show_role displays the active roles of the Database Owner, not the user impersonated with setuser.

See also:
  • Transact-SQL Users Guide

  • alter role, create role, drop role, grant, revoke, set in Reference Manual: Commands

  • sp_activeroles, sp_displayroles in Reference Manual: Procedures

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute show_role.

Related reference
proc_role
role_contain