So I have an insert which looks like this:
INSERT INTO TempDupeData (Sys_InvoiceID, DupeSetID, Netted, InvoiceNo, InvoiceDate, Sys_SupplierID, SuppInvNo, N
First option:
This warning probably could be due to the SQL_MODE.
According to mysql documentation "If the NO_ZERO_DATE or NO_ZERO_IN_DATE SQL mode is enabled, zero dates or part of dates are disallowed.". So this may be the cause your INSERT with '0000-00-00 00:00:00' fails.
You can check your sql mode by executing this:
SELECT @@sql_mode;
and if any of the NO_ZERO_DATE or NO_ZERO_IN_DATE are set, then you can just:
SET sql_mode = '';
Second option
The other option is it is failing because of the STRICT_TRANS_TABLES mode.
As mysql documentation say:
Strict mode affects whether the server permits '0000-00-00' as a valid date: If strict mode is not enabled, '0000-00-00' is permitted and inserts produce no warning. If strict mode is enabled, '0000-00-00' is not permitted and inserts produce an error, unless IGNORE is given as well. For INSERT IGNORE and UPDATE IGNORE, '0000-00-00' is permitted and inserts produce a warning
The same is valid for datetime.
So you have to either disable STRICT MODE OR if disabling it is not an option - modify the query so it doesn't return invalid date/datetime result
Put this code before query
SET sql_mode = '';
or
go to /etc/mysql/my.cnf & comment out STRICT_TRANS_TABLES
useful note SQL STRICT MODE