Using a trigger to record audit information vs. stored procedure

Posted by Germ on Stack Overflow See other posts from Stack Overflow or by Germ
Published on 2010-04-19T22:07:30Z Indexed on 2010/04/19 23:03 UTC
Read the original article Hit count: 164

Filed under:
|
|
|

Suppose you have the following... An ASP.NET web application that calls a stored procedure to delete a record. The table has a trigger on it that will insert an audit entry each time a record is deleted. I want to be able to record in the audit entry the username of who deleted the record. What would be the best way to go about achieving this? I know I could remove the trigger and have the delete stored procedure insert the audit entry prior to deleting but are there any other recommeded alternative?

If a username was passed as a parameter to the delete stored procedure, is there anyway to get this value in the trigger that's excuted when the record is deleted? I'm just throwing this out there...

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about sql