There is a function in SQL Server 2005 that returns the WINDOWS login of the person running a query.
It's not System_user or Current_User or User_Name.
For Windows users connecting to SQL Server with a SQL account, those return the SQL login.
But this application always runs under the account ProgramUser (for example). But I need to audit whether 'JDoe', 'SSmith' or 'MBrown' is the windows login behind it.
I've used this before but I can't find it today ...
What's the function I'm looking for!