vendredi 15 juillet 2016

Ignore date conversion warnings (MySQL)

I have CSV file, contains date field that has either:
1. %Y-%m-%d
2. %m/%d/%Y
3. empty string

The code I use for importing:

LOAD DATA INFILE ...
SET EpStartDate = IFNULL (DATE(@v_EpStartDate), STR_TO_DATE(@v_EpStartDate, '%m/%d/%Y')),
...

But this code throws warning about every %m/%d/%Y date, and about each empty cell.

It's very important to me to show only crucial warnings, when the data is wrong, like if the date is 03/18/20095.

Any idea how to do that?

Aucun commentaire:

Enregistrer un commentaire