proc_role

Description

Returns information about whether the user has been granted the specified role.

Syntax

proc_role ("role_name")

Parameters

role_name

is the name of a system or user-defined role.

Examples

Example 1

Creates a procedure to check if the user is a System Administrator:

create procedure sa_check as 
if (proc_role("sa_role") > 0) 
begin 
    print "You are a System Administrator." 
    return(1) 
end

Example 2

Checks that the user has been granted the System Security Officer role:

select proc_role("sso_role")

Example 3

Checks that the user has been granted the Operator role:

select proc_role("oper_role")

Usage

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute proc_role.

See also

Commands alter role, create role, drop role, grant, set, revoke

Functions mut_excl_roles, role_contain, role_id, role_name, show_role