This is my first time writing a trigger in SQL Server 2000. Needed some guidance with syntax. I have a table(table1) with exact same copy(table2) in a different database. The only difference in the table structure being that two fields from table1 are concatenated into one in table2.
I want to write a trigger that will keep table2 in sync with table1. Whether it's an insert, delete or an update on table1, table2 should be the same. Need some help with the syntax.
This is what I have so far..I am little confused about insert/update syntax. Any help will be highly appreciated.
CREATE TRIGGER TRG_DC ON [dbo].[TABLE1]
FOR INSERT, UPDATE, DELETE
DECLARE @DC VARCHAR(5)
SELECT @DC = (SELECT do_group+do_ssc FROM INSERTED)
DELETE FROM TABLE2
WHERE ID IN (SELECT ID FROM DELETED)