create trigger TRG_CONTRIBUINTES_VERIFCA_RF_E_NIF on contribuintesfor updateas begin update contribuintes set nif = d.nif from inserted i join deleted d on d.SomeID = i.SomeID where i.numeroposto = 'Central' update contribuintes set cod_rep_fiscal = d.cod_rep_fiscal from inserted i join deleted d on d.SomeID = i.SomeID where i.cod_rep_fiscal not in (select cod_rep_fiscal from V_RETURN_RF) end