October 6, 2025 at 8:42 am
When you want it 100% correct, you should use ORIGINAL_LOGIN().
A sysadmin has the privilege to inpersonate another account (I use this sometimes to check permissions).
And only ORIGINAL_LOGIN() would return my own username instead of 'whoever', and particularly in auditing you want to know who it REALLY was
EXECUTE AS LOGIN = 'whoever';
SELECT CURRENT_USER, SYSTEM_USER, ORIGINAL_LOGIN()
REVERT;
God is real, unless declared integer.
October 7, 2025 at 1:40 am
When you want it 100% correct, you should use ORIGINAL_LOGIN().
Especially when, IMHO, people use that nasty little word of "audit" like they did in this question.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply