Skip to content

REVERT

-- Assume there is an existing connection with CONTROL SERVER
EXECUTE AS USER = 'CompanyUser01';
SELECT SUSER_NAME();
REVERT;
SELECT SUSER_NAME();
CompanyUser01
sa (or a different login with CONTROL SERVER)

The EXECUTE AS USER statement is used to change the execution context to the specific user ‘CompanyUser01’. The SUSER_NAME() function is then used to display the name of the user currently being utilized. Following this, the REVERT command is used to revert the context back to the prior user, and finally SUSER_NAME() function is used once more to confirm that the context has been reverted.