I have an application which connects to SQL Server 2000 (using a generic SQL Login and SQL Authentication). I would like to implement some logging via triggers to track data changes. I can't use USER_NAME()
because that returns the generic account.
I've poked through master..sysprocesses
and it doesn't seem to record the username (although it does record the machine name).
Any ideas how, within SQL, to gain access to the username?
(Note: yes, I could pass it in as a variable via the application ... but that would mean I'd have to roll out a new version of the app; I'm trying to do this from within SQL, so I can avoid that, if possible.)