Hi all,
I have written a set of triggers to capture any changes on gaiven table. At the moment when a change is made the triggers captures all of the fields associated with the changed record, and puts it in an identical table in another database. Is there a way I could write the trigger to capture only the changed fields from a given record? a sort of dynamic capture????
The exapmle below obnly has to deal with a few fields but this can get confusing with larger tables.
Here is the example code:
CREATE TRIGGER [dbo].[update_Cent]
ON dbo.Cent
AFTER UPDATE
AS
INSERT INTO [Audit].[dbo].[Cent_AUD]
(StatusID, Status, [Description],
ChangeType, ChangeDate, UserName)
SELECT StatusID, Status, [Description],
'Update', getdate(), user
FROM deleted
Thanks,
Andy