Implicit Context Switching

With implicit context switching, the execution context is set within a module such as a stored procedure, trigger, or user-defined function. The EXECUTE AS clause is placed in the module and is set to the user that the module will be run as. The context switch is implicit because the user who runs the module does not have to explicitly specify the context before running the module. The context is set within the module.

The EXECUTE AS clause has several different options to establish the execution context. All modules are able to set the context to a specific user or login. Functions, stored procedures, and Data Manipulation Language (DML) triggers can also execute as CALLER, SELF, or OWNER. DDL triggers can run as ...

Get Microsoft SQL Server 2014 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.