sp_role

Description

Grants or revokes roles to an Adaptive Server login account.

Syntax

sp_role {"grant" | "revoke"}, rolename, loginame

Parameters

grant | revoke

specifies whether to grant the role to or revoke the role from loginame.

rolename

is the role to be granted or revoked.

loginame

is the login account to or from which the role is to be granted or revoked.

Examples

Example 1

Grants the System Administrator role to the login account named “alexander”:

sp_role "grant", sa_role, alexander

Usage

Permissions

Only a System Administrator can execute sp_role to grant the System Administrator role to other users. Only a System Security Officer can execute sp_role to grant any role other than “sa” to other users.

Auditing

Values in event and extrainfo columns from the sysaudits table are:

Event

Audit option

Command or access audited

Information in extrainfo

38

exec_procedure

Execution of a procedure

  • Roles – Current active roles

  • Keywords or options – NULL

  • Previous value – NULL

  • Current value – NULL

  • Other information – All input parameters

  • Proxy information – Original login name, if set proxy in effect

See also

Commands grant, revoke, set

Functions proc_role, show_role

System procedures sp_activeroles, sp_displayroles, sp_displayroles