CREATE TRIGGER DResolved ON HEAT.Asgnmnt
FOR INSERT, UPDATE
AS
\\I need to perform the actions of the trigger only if the value for DateResolve is empty. Ie..IF (select DateResolv from Asgnmnt a JOIN Inserted i ON a.HEATSeq = i.HEATSeq) = 'NULL'
BEGIN
Update Asgnmnt
set DateResolv = (select convert(varchar(10), getdate(), 102))
FROM Asgnmnt a JOIN Inserted i ON a.HEATSeq = i.HEATSeq
Update Asgnmnt
set DateResolv = (select convert(varchar(10), getdate(), 102))
FROM Asgnmnt a JOIN Deleted d ON a.HEATSeq = d.HEATSeq
END
FOR INSERT, UPDATE
AS
\\I need to perform the actions of the trigger only if the value for DateResolve is empty. Ie..IF (select DateResolv from Asgnmnt a JOIN Inserted i ON a.HEATSeq = i.HEATSeq) = 'NULL'
BEGIN
Update Asgnmnt
set DateResolv = (select convert(varchar(10), getdate(), 102))
FROM Asgnmnt a JOIN Inserted i ON a.HEATSeq = i.HEATSeq
Update Asgnmnt
set DateResolv = (select convert(varchar(10), getdate(), 102))
FROM Asgnmnt a JOIN Deleted d ON a.HEATSeq = d.HEATSeq
END