Execute As Flashcards Preview

70-464 Certification > Execute As > Flashcards

Flashcards in Execute As Deck (4)
Loading flashcards...
1

Why use EXECUTE AS?

When you want a user to be able to run a query or stored procedure one time without having to modify the underlying security permanently

2

What is the syntax to EXECUTE AS?

EXEC(UTE) AS USER = 'USERNAME'
REVERT

3

What if you don't want the EXECUTE AS statement to end even with a REVERT statement?

EXEC AS USER = 'USERNAME' WITH NO REVERT

4

What if you want to specifically revert the EXECUTE AS statement?

Use WITH COOKIE:
DECLARE @COOKIE = VARBINARY(8000)
EXEC AS USER = 'USERNAME' WITH COOKIE INTO @COOKIE

Then: REVERT WITH COOKIE = @COOKIE