have tableA a which has an ID field, and a status field of either 'active' or inactive'
I have a related table, tableb which has the id field to match the record of the row in tableA, and it has a status flag of 'y' or 'n'. I need a trigger (has to work on mass updates so I can't use variables for my compare) If the status is changed from Active to inactive in tablea I need the corresponding record in tableb to have the flag changed to 'n'. I tried below, but not working. I was trying to do a compare using inserted versus deleted
alter trigger tim1 on tablea for update as
select inserted.id from inserted inner join deleted on
inserted.id = deleted.id where
inserted.status = 'inactive' and deleted.status = 'active'
if @@rowcount =1
set status = 'N' from inserted
where tableb.id = inserted.id