I need to audit changes for some tables and I want to do it using triggers.
This article Coding the After Delete Trigger in SQL Server represents pretty much what I want to do, that is to say, for every TABLE to audit, I'll have a TABLE_HISTORY where all the changes will be saved when a row is inserted, updated or deleted. The main problem I have is that I want to save the username of the user logged in the application, I have a custom table USERS where I keep this information, but I don't know how to pass it since triggers do not admit parameters.
I've looked this article also Log record changes in SQL server in an audit table , but it uses SYSTEM_USER.
Any help will be appreciated.