I am attempting to create a SQL Trigger on a column when updating.
The following is incorrect:
CREATE TRIGGER cus_name
ON dbo.customertable
FOR UPDATE AS
IF UPDATE(cus_name)
INSERT INTO AUDITTABLE(AUD_TABLENAME,AUD_COLNAME,AUD_OLD,AUD_NEW,AUD_DATE,LANID,COMPNO)
VALUES ('customertable','cus_name',deleted.cus_name,inserted.cus_name,GETDATE(),inserted.lanid,inserted.compno)
Does anybody know the correct way?
Richard DeZeeuw
DeZeeuw Software Inc.