Iter Ator
Iter Ator

Reputation: 9299

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

Upvotes: 0

Views: 299

Answers (1)

sdrzymala
sdrzymala

Reputation: 387

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

Upvotes: 2

Related Questions