I have two tables: Table1 and Table2
What I want to do is create a trigger that, when col1 on Table1 is updated it automatically updates col1 on Table2. However should col1 on Table1 be updated to NULL I wish is to be ignored i.e. any NULL value updates on TABLE1.COL1 should be ignored.
I thought the following would work but it doesn't
CREATE TRIGGER [UPDATE] ON [dbo].[TABLE1]
FOR INSERT, UPDATE, DELETE
AS
UPDATE Table2
SET[COL1] =
(SELECT [COL1]
FROM table1
WHERE table1.[1] IS NOT NULL
AND table1.ID =table2.id)
Any ideas where I am going wrong?