August 14, 2004 at 6:50 pm
Greetings,
I've created a trigger on a table that monitors updates to certain columns in the table. Specifically, a table named "tblProject" has 3 "starting price" fields: start_cost, start_sell, and start_list. The trigger works quite well, creating 2 records in a table named "tblProjectTblAudit". Each update to a record in the Project table creates a "before" record and an "after" record to document the values before and after a user modifies the record.
However, I've got one missing piece: I want to be able to add the user's name (or login name), to the Audit table so I know who made the change. Does anyone out there know how to determine which user made the change?
Some specifics on our system:
Unfortunately, I don't have the code in front of me, but it uses 2 INSERT and SELECT statements to gather information from the logical DELETED and INSERTED tables to form the records for the Audit table.
Any help would be greatly appreciated!
August 14, 2004 at 7:07 pm
suser_sname() in the trigger will return the Windows login. Insert that into the field you want to keep it in.
August 16, 2004 at 8:10 pm
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply