Shows the login’s currently active system-defined roles.
show_role()
select show_role()
sa_role sso_role oper_role replication_role
if charindex("sa_role", show_role()) >0 begin print "You have sa_role" end
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.
For general information about system functions, see “System functions”.
ANSI SQL – Compliance level: Transact-SQL extension.
Any user can execute show_role.
Commands alter role, create role, drop role, grant, set, revoke
Functions proc_role, role_contain
System procedures sp_activeroles, sp_displayroles, sp_role