i want to audit transactions done to table TOrig.
I created table TAudit same as TOrig in addition to ActionID (1 for
insert, 2 for update, 3 for delete), System Date and System User.
I created triggers on TOrigto insert into TAudit in case of insert,
update & delete.
TOrig contains text column. So i created instead of Trigger like:
Create TRIGGER TrigDelete
ON dbo.TOrig
Instead of Delete
AS
declare @id int
select @id=Liq_ID from Deleted
If Not Exists (Select * from TAudit where Liq_ID=@id and ActionID=3 )
BEGIN
Insert into TAudit
select * , 3, GetDate(), System_USer
from Deleted
Delete from TOrig where Liq_ID=@id
END
GO
PROBLEM: is that Torig is a detail table to a master table and has a
cascade delete relationship with the master table.
So Instead Trigger does it work. What do I DO????