>Hi,
>
>Could you please explain why (where is the rule?) the SQL Server always looks at the date in the following format: 'yyyyMMdd' (no matter the date format of the country where the SQL Server is installed).
>
>That is, the following code:
>
>DECLARE @SomeDate AS SmallDateTime
>SELECT @SomeDate = '20190204'
>SELECT @SomeDate
>
>
>always returns February 4th of 2019 (and NOT April 2nd).
>
>TIA
Dmitry,
I'll guess a bit here and assume that MSSQL tries to follow ISO8601. I think that an unambiguous datetime representation is given by yyyy-mm-ddThh:mm:ss. Notice the T between date and time parts: that's an ISO8601 convention that I believe MSSQL recognizes and uses, no matter what regional settings are in place.
yyyymmdd is a valid ISO8601 short representation of a date.
----------------------------------
António Tavares Lopes