jp2631 jp2631 - 7 months ago 14
SQL Question

Type EAL.STATUS_DATE is not a defined system type

All, I'm trying to shorting my date and time data. Here is the current code...

ISNULL(EAL.STATUS_DATE,'01/01/1960') AS STATUS_DATE

Result...
2016-04-18 00:00:00.000

and I want it to returns only 2016-04-18
I tried this code ISNULL(CONVERT(EAL.STATUS_DATE,'01/01/1960'),110) AS STATUS_DATE but got this error Type EAL.STATUS_DATE is not a defined system type.

Please help

Answer

You got the two functions mixed together incorrectly. the convert belongs only around the datetime field. then you do the isnull on the outside of that. You also have the syntax of convert wrong.

ISNULL(CONVERT(date,EAL.STATUS_DATE,110), '01/01/1960')