SETUSER Statement

Allows a user to temporarily assume the roles and system privileges of another user (also known as impersonation) to perform operations, provided they already have the minimum required privileges to perform the task to begin with.

Note: The SET USER system privilege is two words; the SETUSER statement is one word.

Quick Links:

Go to Parameters

Go to Usage

Go to Standards

Go to Permissions

Syntax

SETUSER userID

Parameters

(back to top)

Usage

(back to top)

At-least criteria validation occurs when the SETUSER statement is executed, not when the SET USER system privilege is granted.

To terminate a successful impersonation, issue the SETUSER statement without specifying a userID.

Standards

(back to top)

ANSI SQL–Compliance level: Transact-SQL extension.

Permissions

(back to top)

Requires the following: