I have a trigger on table tblA
if the status is closed
it inserts a record to table tblB
. The below code is working, but I want it to be executed only if the previous status was NOT closed
. How can I check it?
ON tblA
AFTER UPDATE
AS
BEGIN
SET NOCOUNT ON
INSERT INTO tblB
(a_id, action, usr)
select a.ID, 'closed', a.usr
from tblA a
WHERE a.Status LIKE 'closed';
END