The last few hours I was looking for a method to make the
datetime data types easier machine readable and more predictable in string representation. There are two things you have to do:
- The first thing is to select the correct language environment, just to be sure. I my case this is english:
SET LANGUAGE english. This ensures, that the „natueral representation“ is always the same.
- The second thing is: you have to type cast the date/datetime field via
CONVERT(char(19),DateTimeField,120) AS DateTimeFieldfor datetime fields and
CONVERT(char(10),DateField,103) AS DateFieldfor date-only fields.
Kind of fucked up, but if you have to use MS SQL Server you are used to fucked-up solutions.