I am reading a value from a key/value table that should contain a NULLABLE date with the format yyyy-MM-dd
.
The simplified version of the query is.
SELECT CAST(ClaimDate AS DATE) AS ClaimDate
FROM MyTable
This leads to the error message:
Conversion failed when converting date and/or time from character string.
I have tried CONVERT(DATE, ClaimDate)
as well to no avail.
Now, more than knowing why I get this error, I am curious to know which values are causing this.
I have seen several questions regarding the error message above. But I haven't found the one giving an answer to my problem.
Of course, suggesting a solution in addition to getting bad values is highly appreciated.