Few months ago I started a series where I explained all about Execution Context & Context switching, you can use Execution context switching for many reasons but if you are auditing execution context can leave all your auditing meaningless.
You’ve to plan in advance for such Execution context switching and the below mentioned Function can help you identify the Original login even if the context has been switched.
This function will help you get the name of the login that connected to the instance of SQL Server. You can use this function to return the identity of the original login in sessions in which there are many explicit or implicit context switches.
There is a saying A picture is worth a thousand words, So here is the screenshot which can help you understand this better
Hope it is now clear, feel free to leave a comment. 🙂
Sarabpreet Singh Anand
Subscribe now to get latest Tips\blog posts in your Inbox