Torna al Thread
ALTER TRIGGER [dbo].[trD_Letture]
ON [dbo].[LETTURE]
for INSERT
AS
update dbo.letture
set letture.datarif= dateadd(yyyy,-1,letture.datarif),trucco=1, letture.orarioPuntaCont=dateadd(yyyy,-1,letture.orariopuntacont),letture.orariopuntacorr=dateadd(yyyy,-1,letture.orariopuntacorr)
from inserted as I
where (year(letture.datarif)=2010 and year(letture.orarioPuntaCont)=2010) or
(year(letture.datarif)=2010 and year(letture.orarioPuntaCorr)=2010)