I have been benefiting from TRY_CONVERT
function thanks to a reply from my last question.
I am now facing a value in a key/value table (the value column of type NVARCHAR(50)
) that cannot be converted to DATE
even though it very much looks like a date.
I'd like to why TRY_CONVERT(DATE, [Claim issue complete])
should return a NULL
.
Even though I use a substring of the value like this the result is the same
SELECT SUBSTRING([Claim issue complete], 1, 10) AS CompletionDate
UPDATE: A textual copy of the picture
Claim issue complete
2018-09-21 00:00:00+02
2017-10-12 00:00:00+02
2018-01-30 00:00:00+01
2017-07-19 00:00:00+02
2019-02-14 00:00:00+01
NULL
2017-08-06 00:00:00+02
2017-10-04 00:00:00+02
2018-05-18 00:00:00+02
2018-09-05 00:00:00+02
2019-01-14 00:00:00+01
2019-01-24 00:00:00+01
2018-03-21 00:00:00+01
2017-11-28 00:00:00+01
2018-02-26 00:00:00+01
2018-04-05 00:00:00+02
2018-04-27 00:00:00+02
Update 2: An Example
Here is a sample of the problem.
SELECT TRY_CONVERT(DATE, '2018-09-21 00:00:00+02')
The above returns NULL
.