PDA

View Full Version : SQL trigger run update on second table



Movian
01-09-2015, 09:30 AM
Ok so now I am stumped again writing what should be a simpler trigger

I have a trigger that inserts a duplicate record in a backup table

now I need a second triger that writes updates to that table to

the following is Psuedo for what I need, but every example I can find either updates a single field or does an insert instead.

The whole point of this is create a backup table where if a record is deleted / removed / corrupted it can be easily copied from this backup table back to the main table.


Create Trigger BackupTableUpdate
On MyTable
AFTER Update
AS
Begin
UPDATE MyBackupTable Set All columns = new value
end