A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  special characters  sybase-tech-blog


Category: ASE: Functions: User, Login and Role Functions

proc_role()

The role function proc_role() checks if a user has been grant ed the role declared in the parameter "role_name", i.e. if the user has been given the corresponding role specific privileges. Sybase recommends users of ASE® starting with version 15.0 to use the has_role() function instead of proc_role().

The function proc_role() returns three different numeric values (0,1,und 2). The value varies depending on whether the role declared in the parameter "role_name" has been granted to the user and if it is an active role for this user. The value "0" is returned if the specified role has not been granted, or if it has been granted but not activated for the user. The value "1" is returned if the user has been granted the specified role and also activated. The value "2" is returned for a user who owns an active role which is contained in the role specified in the parameter "role_name".

Syntax of the Role Function proc_role()

    proc_role("role_name")
    

The parameter of the Role Function proc_role()

role_name
The parameter "role_name" is a placeholder for roles.

Example for the Role Function proc_role()

    select proc_role("sso_role")
go
-----
1

Shows that the user was granted the role of the "System Security Officer" and that this is an active role for the user.

See also:
alter role,
create role,
drop role,
grant role,
revoke role,
set role,
has_role(),
mut_excl_roles(),
role_contain(),
role_id(),
role_name(),
show_role(),
sp_activeroles,
sp_displayroles,
sp_role,
suser_id(),
suser_name(),
user,
user_id(),
user_name(),
valid_user() and
Functions.

See also:

ASE T-SQL - Aggregate Functions,
ASE T-SQL - User,
mut_excl_roles(),
role_contain(),
role_id(),
role_name(),
show_role(),
suser_id(),
suser_name(),
user,
user_id(),
user_name(),
valid_name(),
valid_user().