Syntax
Parameters
user: The user must already exist.
Usage notes
- The current login user (who calls the EXECUTE AS statement) must be granted the privilege to impersonate another user. For more information, see GRANT.
- The EXECUTE AS statement must contain the WITH NO REVERT clause, which means the execution context of the current session cannot be switched back to the original login user before the current session ends.
Examples
Switch the execution context of the current session to the usertest2.
select current_user() command to obtain the current user.