Page 1 of 1

Solved: Incorrect date value: '0000-00-00' for column

Posted: Wed Apr 22, 2020 7:18 pm
by mister_v
Hi,

somehow there are is a "bad" date in the table ( 0000-00-00' ),
It tried to update it to another value
but each time I get the error-message:

Code: Select all

Incorrect date value: '0000-00-00' for column 
Even delete doesn't work:

Code: Select all

DELETE FROM table WHERE start_date='0000-00-00';
How do I fix this?

Re: Incorrect date value: '0000-00-00' for column

Posted: Thu Apr 23, 2020 6:59 am
by chris
The error is because MYSQL is in strict mode (default)

You can Check MYSQL mode

Code: Select all

SELECT @@GLOBAL.sql_mode global, @@SESSION.sql_mode session

You change it with the following query;

Code: Select all

SET sql_mode = '';
or

Code: Select all

SET GLOBAL sql_mode = '';
Using the keyword GLOBAL requires super privileges and it affects the operations all clients connect from that time on !

Re: Incorrect date value: '0000-00-00' for column

Posted: Thu Apr 23, 2020 9:46 am
by mister_v
Thanks that solved it