March 6, 2012 at 7:11 pm
Hi,
I have a scenario..where an application user can login to the app and can run some workflows/processes. Some processes are executed as a specific user in the application. In this case the below SQL executes as a Test_Admin login.
EXECUTE As Login = 'Test_Admin'
SELECT Col's
FROM TABLE...
So, when i look at the Activity monitor/sp_who2/sys.sysprocesses, the above query runs as Test_Admin login.
But is there anyway to find out the user who logged in to the application and executed the above Query..
I would like o find out the application user while executing the query.
I tried querying syslogins and sysprocesses, but I only get Test_Admin info.
Please help!
Thanks.
March 6, 2012 at 8:16 pm
Check out this DMV in Books Online: sys.dm_exec_sessions
March 6, 2012 at 9:02 pm
jack_kiran (3/6/2012)
I would like o find out the application user while executing the query.
Lynn's suggestion is fine if you want to look at it externally. If you want to know within the query, do a SELECT ORIGINAL_LOGIN() within the query.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply