1
I am trying to do a less sql account in sql Sever management but this format error. I am wanting to do the months account 202103 - 202101 = 2 months
How to solve this format problem?
select *
,DPD = datediff(day, Dt_Atraso, Dt_Ref)
,DIAS_Prazo = datediff(day, Dt_Abertura, Dt_Vencimento)
**,DIFERENCA = (MES_ATUAL - MES_ATRASO)**
from #chuv_pJ
ERROR:
Msg 402, Level 16, State 1, Line 4 The data types varchar and varchar are incompatible in the subtract operator.
datediff(day, Dt_Abertura, Dt_Vencimento)
if you want the difference in months, change theday
formonth
– Ricardo Pontual