GRANT SET USER Statement

Grants the ability for one user to impersonate another user and to administer the SET USER system privilege.

A user can be granted the ability to impersonate any user in the database (ANY) or only specific users (target_users_list) or members of specific roles (ANY WITH ROLES target_roles_list). Administrative rights to the SET USER system privilege can only be granted when using the ANY clause.

Syntax

GRANT SET USER ( target_usesr_list | ANY | ANY WITH ROLES target_roles_list )
  TO userID [,...] 
  [ WITH ADMIN [ONLY] OPTION | WITH NO ADMIN OPTION]

Parameters

Examples

Usage

If no clause is specified, ANY is used by default.

If no administrative clause is specified in the grant statement, the WITH NO ADMIN OPTION clause is used.

If regranting the SET USER system privilege to a user, the effect of the regrant is cumulative.

By default, the SET USER system privilege is granted to the SYS_AUTH_SSO_ROLE compatibility role with the WITH NO ADMIN OPTION clause, if they exist.

The granting of the SET USER system privilege to a user only grants the potential to impersonate another user. Validation of the at-least criteria required to successfully impersonate another user does no occur until the SETUSER statement is issued.

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions