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

Post Reply
mister_v
Posts: 174
Joined: Thu Mar 04, 2010 9:19 pm

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

Post 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?
Last edited by mister_v on Thu Apr 23, 2020 9:46 am, edited 1 time in total.
chris
Site Admin
Posts: 177
Joined: Mon Jul 21, 2008 9:52 am

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

Post 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 !
mister_v
Posts: 174
Joined: Thu Mar 04, 2010 9:19 pm

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

Post by mister_v »

Thanks that solved it
Post Reply