role_id

Description

Returns the system role ID of the role whose name you specify.

Syntax

role_id("role_name")

Parameters

role_name

is the name of a system or user-defined role. Role names and role IDs are stored in the syssrvroles system table.

Examples

Example 1

Returns the system role ID of sa_role:

select role_id("sa_role")

------
0

Example 2

Returns the system role ID of the “intern_role”:

select role_id("intern_role")

------
6

Usage

Standards

SQL92 – Compliance level: Transact-SQL extension.

Permissions

Any user can execute role_id.

See also

Functions mut_excl_roles,proc_role,role_contain, role_name