0
I have a query that I need to return the interval of days, the problem is that the date fields are defined as varchar(30).
--a data teria que ficar assim
SELECT DATEDIFF(day,'2015/12/16','2015/12/20') AS DiffDate
--data está gravada assim no banco como varchar(30)
SELECT DATEDIFF(day,'16/12/2015','16/12/2015') AS DiffDate
select a.*,
DATEDIFF(DAY,a.EMISSAO,a.VENCIMENTO) as Dias
from TB_DOCUMENTOS_ABERTOS a
inner join TB_CLIENTE b on a.CODIGOCLIENTE = b.CODIGO
ORDER BY b.RAZAO
Error: Message 241, Level 16, Status 1, Line 1 Conversion failed when Converting date and/or time from Character string.