I'm trying to import a CSV file into a MySQL table using Sequel Pro.
I know I need to use STR_TO_DATE, but I can't figure out the right syntax. I've tried this syntax STR_TO_DATE(@$1, '%d/%m/%y')
which is not working.
The CSV file format
Date Created, Date Modified
07/10/16,02/02/17,
07/10/16,,
07/10/16,,
07/10/16,,
07/10/16,23/01/17,
Table schema
CREATE TABLE `date` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`Date Created` date NOT NULL,
`Date Updated` date DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8;
- File > Import. The file comes up and the date field in the CSV is row 1:
- Select Date > Add expression
- Final import view
- Error
The expression is returning STR_TO_DATE(@$1, '%d/%m/%y')
NULL
but I don't know why?