lundi 2 mars 2020

IF "Date field" is wrong can we put default date automatically

I get some data automatically from another table. The date column is a string. I convert this column to DateTime. But sometimes the date field comes like "01.01.0002" or "01.01.0202". When it's happened like this I get this error:

"SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM."

Is that possible to put an If statement to get date "1/1/1753" as default date when it comes wrong?

Aucun commentaire:

Enregistrer un commentaire