guest2013-1
guest
- Joined
- Aug 22, 2003
- Messages
- 19,800
- Reaction score
- 13
I have an AFTER trigger that fires and simply updates an audit log. However, recently, it has come to light that what is in the audit log doesn't reflect what is in the table. So I started looking around.
The trigger fires for this (and inserts into the audit log, it's a stored procedure that updates the record):
BEGIN TRAN h
update myTable set Col1 = @rnd where Col2 = 1
--Pretend something went wrong
ROLLBACK TRAN h
But it doesn't fire again when ROLLBACK is called
This means my audit picks up the edit of the record, but it doesn't show that it went back to the original value before the edit because of the transaction that was rolled back.
Kind of annoying. Any ideas on how to approach this issue?
The trigger fires for this (and inserts into the audit log, it's a stored procedure that updates the record):
BEGIN TRAN h
update myTable set Col1 = @rnd where Col2 = 1
--Pretend something went wrong
ROLLBACK TRAN h
But it doesn't fire again when ROLLBACK is called
This means my audit picks up the edit of the record, but it doesn't show that it went back to the original value before the edit because of the transaction that was rolled back.
Kind of annoying. Any ideas on how to approach this issue?