I am trying to create an update trigger to record when a row is first updated (Not appended) in an application. (I need to record the date/time so that we can evaluate response time to calls on a call tracking application) The key is that I only want to update the First_Worked column if it is null.
Sample is listed below of what I am trying. It fails with an error on the IF deleted.First_worked saying that the prefix deleted does not match a tablename.
Any sample would be useful
CREATE TRIGGER trgFirstWorked ON [Cntct_Contacts]
SELECT * FROM deleted
IF deleted.First_Worked IS NULL
UPDATE [Cntct_Contacts] SET [Cntct_Contacts].First_Worked = GetDate()
FROM [Cntct_Contacts] INNER JOIN deleted
ON [Cntct_Contacts].Call_No = deleted.Call_No