SQL trigger for audit table question

Posted by mattgcon on Stack Overflow See other posts from Stack Overflow or by mattgcon
Published on 2010-06-08T17:22:18Z Indexed on 2010/06/08 17:32 UTC
Read the original article Hit count: 242

Filed under:
|
|

I am writing a trigger to audit updates and deletes in tables. I am using SQL Server 2008

My questions are,

Is there a way to find out what action is being taken on a record without going through the selection phase of the deleted and inserted tables?

Another question is, if the record is being deleted, how do I record within the audit table the user that is performing the delete. (NOTE: the user connected to the database is a general connection string with a set user, I need the user who is logged into either a web app or a windows app)

Please help?

© Stack Overflow or respective owner

Related posts about sql

Related posts about delete