Muchas gracias por la pronta respuesta.
Aparentemente tengo un problema con el case, o al menos ese es el error que lanza sql.
Esto es lo que tengo
Código SQL:
Ver originalSELECT top 4833 CONVERT(VARCHAR(20),fec,120) AS movimiento, (CONVERT(VARCHAR(20),fec_mvto,120)- CAST(getdate() AS datetime)) AS Diff
CASE WHEN (CONVERT(VARCHAR(20),fec_mvto,120)< CAST(getdate() AS datetime))> 0
AND (CONVERT(VARCHAR(20),fec_mvto,120)< CAST(getdate() AS datetime))<= 30 THEN antiguedad ='30 dias'
ELSE CASE WHEN (CONVERT(VARCHAR(20),fec_mvto,120)< CAST(getdate() AS datetime))> 30
AND (CONVERT(VARCHAR(20),fec_mvto,120)< CAST(getdate() AS datetime))<= 60 THEN antiguedad ='60 dias'
ELSE CASE WHEN (CONVERT(VARCHAR(20),fec_mvto,120)< CAST(getdate() AS datetime))> 60
AND (CONVERT(VARCHAR(20),fec_mvto,120)< CAST(getdate() AS datetime))<= 90 THEN antiguedad ='90 o mas dias'
END
END
END
FROM XXX.dbo.XXXXX