Posted on Leave a comment

various security functions

–execute as login = ‘sa’;
–execute as user = ‘guest’;

SELECT @@version
     –current context / execute as
     , user “user” –same as user_name()
     , user_name() “user_name” 
     , current_user “current_user”  
     , session_user “session_user” 

     –current login unless execute as
     , system_user “system_user” 
     , suser_name() “suser_name”  

     –original context
     , ORIGINAL_LOGIN() “original_login” 

GO

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.