has_role

Returns information about whether an invoking user has been granted, and has activated, the specified role.

Syntax

has_role ("role_name", option)

Parameters

Examples

Usage

  • has_role functions the same way proc_role does. In SAP ASE versions 15.0 and later, we recommend that you use has_role instead of proc_role. You need not, hoever, convert all of your existing uses of proc_role to has_role.

  • has_role returns 0 if the user has:
    • Not been granted the specified role

    • Not been granted a role which contains the specified role

    • Been granted, but has not activated, the specified role

  • has_role returns:
    • 1 – if the invoking user has been granted, and has activated, the specified role.

    • 2 – if the invoking user has a currently active role, which contains the specified role.

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

  • Transact-SQL Users Guide

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute has_role.

Related reference
mut_excl_roles
role_contain
role_id
role_name
show_role