SQL Flow Field Guide

EXECUTE AS Clause

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

module runs as CALLER, SELF, OWNER or a user

What changes

Input
module definition
Output or change
module execution context

Syntax at a glance

{ EXEC | EXECUTE } AS { CALLER | SELF | OWNER | 'user_name' }

Work example

A module definition must run under its caller or a named database principal.

Compare ownership chaining, signer permissions, cross-database access, and caller rights before selecting the clause.

Check your work The module exposes only its documented operation to a low-privilege test caller.

Open Microsoft Learn for full syntax, permissions, and details for your version.