I have written the following trigger to update the status field of a record, when the record is updated. Now I have to rewrite the trigger so that it only updates that status when the record is closed. Can someone please help me with the syntax for this conditional trigger?
The following is a sample of the current trigger:
CREATE TRIGGER trgUpdateStatus ON [dbo].[SOWork]
FOR UPDATE AS
BEGIN
Update tblWorkOrderDtl
Set Status = U.Status
FROM tblWorkOrder W, INSERTED U
WHERE U.OrdNbr = W.OrdNbr
AND U.LineItem = W.LineItem
END
Thanks!
RR
The following is a sample of the current trigger:
CREATE TRIGGER trgUpdateStatus ON [dbo].[SOWork]
FOR UPDATE AS
BEGIN
Update tblWorkOrderDtl
Set Status = U.Status
FROM tblWorkOrder W, INSERTED U
WHERE U.OrdNbr = W.OrdNbr
AND U.LineItem = W.LineItem
END
Thanks!
RR