Working with 4D database via ODBC

There are some peculiarities when working with 4D databases and .NET

Date time 0/00/0 12:00

0/00/0 12:00 is valid in ODBC, but not valid in .NET.
Recommendation – wrap all date calls with a CAST
e.g.
SELECT CAST(BIRTHDAY AS VARCHAR) AS BIRTHDAY

alternatively, use a CASE statement to convert this call to something palatable to 4D e.g.

CASE CAST(LASTSEENDATE AS VARCHAR) WHEN '0/00/0 12:00:00' THEN CAST('1/1/1970' AS TIMESTAMP) ELSE LASTSEENDATE END AS LASTSEENDATE

Other alternatives simply don’t work. e.g. ... THEN NULL ELSE ... and NULLIF()