kd11 (5/4/2015)
Let me re-word that, I want to fire a trigger when column2, column3, column5 and column9 are updated/insert (not the other six columns) so do I need to use the "column_update" statement.
column_update is very misleading, since it just checks if the column name was included in the DML command, and not whether the values actually changed.
you might need to handle NULLS as well, so this is just to provide an example:
the best way is to check by comparign the INSERTED virtual table to teh DELETED virtual table, on a column basis.
ie
IF EXISTS(SELECT * FROM INSERTED i INNER JOIN DELETED d ON i.PKColumn = d.PKColumn WHERE i.Name <> d.Name OR i.Address1 <> d.Address1)
BEGIN
--log some extra data? send an email? do something
END
Lowell