CSV import of date field with null

Is it possible to import a CSV file containing a date field which can have null values into a MySQL database? Using an empty field, ‘null’ or ‘\N’ all generate the error

"Error: ER_TRUNCATED_WRONG_VALUE: Incorrect date value … "

I can put default dates into the CSV file I am developing with at the moment as a work around but this is not a solution for live files.

Does the MySQL column allow null in your DB? If so, in your insert step you can use
{{datefieldname.default(null)}} as the insert value. If empty, it will leave as null

Thanks @bpj that works perfectly

1 Like