SQL: Make sure to use ORIGINAL_LOGIN when auditing
I regularly see code where SQL Server DBAs and developers are trying to log which user/login took a particular action within the database. There are many functions which appear to return the information needed, but there’s only one that should normally be used: ORIGINAL_LOGIN().
A login is the way that a connection is authenticated to the server ie: it’s the “who are you?” at the server level.
Most times, a user is a mapping of that login to a particular database. The login and user will often have the same name (and I’d recommend that you do that to avoid confusion) but they do not have to be. A login Terry could be a user Mary in one database and a user Nga in another database.
2018-08-20