Who am I?

  • Comments posted to this topic are about the item Who am I?

  • 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;

    • This reply was modified 4 days, 8 hours ago by Thomas Franz.

    God is real, unless declared integer.

  • Thomas Franz wrote:

    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


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply