EXECUTE AS
impersonation until REVERT
What changes
- Input
- login or user name
- Output or change
- session security context
Syntax at a glance
{ EXEC | EXECUTE } AS <context_specification> [;]
Work example
A reviewed session or module needs a temporary execution context.
Identify the impersonated principal, scope, duration, and matching revert path before running a lab.
Check your work The effective principal is expected during the work and the original context is restored afterward.
Open Microsoft Learn for full syntax, permissions, and details for your version.