Allows a Database Owner to impersonate another user.
setuser ["user_name"]
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
The Database Owner uses setuser to adopt the identity of another user in order to use another user’s database object, to grant permissions, to create an object, or for some other reason.
When the Database Owner uses the setuser command, Adaptive Server checks the permissions of the user being impersonated instead of the permissions of the Database Owner. The user being impersonated must be listed in the sysusers table of the database.
setuser affects permissions only in the local database. It does not affect remote procedure calls or accessing objects in other databases.
The setuser command remains in effect until another setuser command is given or until the current database is changed with the use command.
Executing the setuser command with no user name reestablishes the Database Owner’s original identity.
System Administrators can use setuser to create objects that will be owned by another user. However, since a System Administrator operates outside the permissions system, she or he cannot use setuser to acquire another user’s permissions.
ANSI SQL – Compliance level: Transact-SQL extension.
setuser permission defaults to the Database Owner and is not transferable.