Q:

How to fix invalid dates in mssql?

I have a column, called date_col
I would like to fix the invalid dates, for example february 31, and convert them to valid dates.
I tried this:
CAST(CAST(date_col AS TIMESTAMP) AS DATETIME)

But I get the following error:
Arithmetic overflow error converting expression to data type datetime

A:

First of all, you can use ISDate function to check if the data is correct

