﻿disable trigger tr_felhasznaloLog on t_felhasznalo

update newTanev
set newTanev.c_anyjaneveelvalaszto = oldTanev.c_anyjaneveelvalaszto, newTanev.LASTCHANGED = GETDATE()
from t_felhasznalo newTanev
inner join t_felhasznalo oldTanev on oldTanev.c_oktatasiazonosito = newTanev.c_oktatasiazonosito and newTanev.c_intezmenyid = oldTanev.c_intezmenyid
where newTanev.c_anyjaneveelvalaszto = 0 and newTanev.torolt = 'F' and oldTanev.torolt = 'F'
      and oldTanev.c_tanevid = (select id from t_tanev t where t.c_nev = '2016/2017' and t.c_intezmenyid = oldTanev.c_intezmenyid and t.torolt = 'F')
      and newTanev.c_tanevid = (select id from t_tanev t where t.c_nev = '2017/2018' and t.c_intezmenyid = newTanev.c_intezmenyid and t.torolt = 'F');

enable trigger tr_felhasznaloLog on t_felhasznalo

go
