0
I have an SQL Server table called Dm_tempo. Its fields are:
DtRef
AnoRef
MesRef
DiaRef
MesExtenso
CodDiaSemana
SemanaNumero
IndFeriado
And already have in it days marked as holidays (in this case, Indferiado = 'SIM'). But what I wanted to do was the following, for example: if a date that was on a Friday (Coddiasemana = 6) is not a holiday, but the day before it was, I have to do an UPDATE for this Friday to be considered a holiday too (like a holiday). I tried something like this:
UPDATE DM_Tempo
SET IndFeriado = 'SIM'
WHERE AnoRef IN (2017,2018)
AND IndFeriado = 'NÃO'
AND CodDiaSemana = 6
AND IndFeriado IN (
SELECT IndFeriado FROM DM_TempoEmpresa T2 WHERE T2.DtRef =
DATEADD(DAY,-1,T1.DtRef) AND T2.IndFeriado = 'SIM'
)
order by 2,1
But it didn’t work. What could I do?