REVERT

Switch execution context back to the caller of the last EXECUTE AS statement.

Syntax
      REVERT [WITH COOKIE = @varbinary_variable]

Key
   WITH COOKIE     Cookie created in a corresponding EXECUTE AS stand-alone statement.
                      

REVERT can be specified as a stand-alone statement or used within a stored procedure or user-defined function.
varbinary_variable is varbinary(100)

Example

CREATE PROCEDURE dbo.Myprocedure 
WITH EXECUTE AS CALLER
AS
...
EXECUTE AS USER = 'service_account';
...
REVERT;
...
GO

"I don't know if I believe in role models. We're all so different; we're all individuals. In the long run, that's what matters" - Wilson Cruz

Related commands:

EXECUTE AS
Equivalent Oracle command: ALTER SESSION SET CURRENT_SCHEMA = schema


© Copyright SS64.com 1999-2014
Some rights reserved