setuser

Description

Allows a Database Owner to impersonate another user.

Syntax

setuser ["user_name"]

Examples

Example 1

The Database Owner temporarily adopts Mary’s identity in the database in order to grant Joe permissions on authors, a table owned by Mary:

setuser "mary" 
go 
grant select on authors to joe 
setuser 
go

Usage

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

setuser permission defaults to the Database Owner and is not transferable.

Auditing

Values in event and extrainfo columns of sysaudits are:

Event

Audit option

Command or access audited

Information in extrainfo

84

setuser

setuser

  • Roles – Current active roles

  • Keywords or options – NULL

  • Previous value – NULL

  • Current value – NULL

  • Other information – Name of the user being set

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

See also

Commands grant, revoke, use