What does this return?
SELECT USER_NAME() -- Returns Andy
EXECUTE AS Brian
GO
EXECUTE AS Steve
GO
REVERT
GO
SELECT USER_NAME()
Answer
Brian
Explanation
The execution context switches can be nested, so changing to Brian, then Steve, then issuing a Revert will return you to the context of Brian. This works in the same manner as a stack.