I wrote a lot of answers about conversions dateor datetimefrom strings. Living in a German-speaking country, I'm used to dealing with date formats other than us_english, and I'm used to using protected literals (I prefer the format ODBC), and I never use CONVERTwithout the third parameter. This is not a question, and please do not give answers in this direction ...
It can often be read that the format yyyy-mm-ddis standard (ISO8601, ANSI, independently) and therefore culture independent.
Today I had to edit one of these older answers , as I said there that the observed behavior depends on something else.
The question arises:
Why (if there is a reason) is there a difference between dateand datetime?
... at least in my environment, which is currently SQL Server 2014 (12.0.4237.0).
I hope this has not been asked before ...
Try the following:
There are no problems, it dateworks as expected
SET LANGUAGE ENGLISH;
DECLARE @dt DATE='2017-01-13';
SELECT @dt;
SELECT CAST('2017-01-13' AS DATE);
SELECT CONVERT(DATE,'2017-01-13');
GO
SET LANGUAGE GERMAN;
DECLARE @dt DATE='2017-01-13';
SELECT @dt;
SELECT CAST('2017-01-13' AS DATE);
SELECT CONVERT(DATE,'2017-01-13');
But now check the same with datetime
SET LANGUAGE ENGLISH;
DECLARE @dt DATETIME='2017-01-13';
SELECT @dt;
SELECT CAST('2017-01-13' AS DATETIME);
SELECT CONVERT(DATETIME,'2017-01-13');
GO
SET LANGUAGE GERMAN;
DECLARE @dt DATETIME='2017-01-13';
SELECT @dt;
SELECT CAST('2017-01-13' AS DATETIME);
SELECT CONVERT(DATETIME,'2017-01-13');
Is it a mistake, a goal or just grubbiness?