Michael L John (3/6/2015)
Simplify this.In the update trigger, delete the rows in the slave tables that match the deleted table, and insert the rows in the slave tables from the inserted trigger.
You never have to worry about updating, matching, etc. etc.
DELETE SlaveTable
WHERE EXISTS (SELECT 1 FROM Deleted WHERE Deleted.Entity = SlaveTable.Entity
AND Deleted.Code = SlaveTable.Code)
INSERT INTO SlaveTable (Entity, Code, Description)
SELECT Entity, Code, Description
FROM Inserted
Do you think that it will work?
it seems too simple 🙂