Reputation:
Is there a function which returns the WINDOWS USER (NOT the database user!) within a procedure which is "EXECUTE AS OWNER" ?
Will ORIGINAL_LOGIN() do this, or does that only return the database user ?
Consider the following situation:
Now, anne is logging into the SQL Database via Windows Authentification (so she is database user "PLANNERS"), and she calls the procedure. In this procedure, I want to retrieve the Windows User ("anne").
Upvotes: 2
Views: 1055
Reputation:
ORIGINAL_LOGIN() is the correct answer.
Just needed it again ;) Thanks @deterministicfail
Upvotes: 1