MySQL - Incorrect datetime value: '0000-00-00 00:00:00' for column 'DateTime' at row 1:
Getting error "Incorrect datetime value: '0000-00-00 00:00:00' for column 'DateTime' at row 1", while trying to ALTER TABLE.
When we try to ALTER table, MySQL rebuilt table and checks validity of the data. If DateTime column has '0000-00-00 00:00:00' value then it does not allow to ALTER the table, and generates error - Incorrect datetime value: '0000-00-00 00:00:00' for column 'DateTime' at row 1:
We have two options to get rid off this error:
01. Update zero dates with valid value
02. Disable the NO_ZERO_DATE SQL modes mode
Disable the NO_ZERO_DATE SQL modes mode:
SET SESSION sql_mode = sys.list_drop(@@session.sql_mode, 'NO_ZERO_DATE');
Now you will be able to ALTER TABLE
Getting error "Incorrect datetime value: '0000-00-00 00:00:00' for column 'DateTime' at row 1", while trying to ALTER TABLE.
When we try to ALTER table, MySQL rebuilt table and checks validity of the data. If DateTime column has '0000-00-00 00:00:00' value then it does not allow to ALTER the table, and generates error - Incorrect datetime value: '0000-00-00 00:00:00' for column 'DateTime' at row 1:
We have two options to get rid off this error:
01. Update zero dates with valid value
02. Disable the NO_ZERO_DATE SQL modes mode
Disable the NO_ZERO_DATE SQL modes mode:
SET SESSION sql_mode = sys.list_drop(@@session.sql_mode, 'NO_ZERO_DATE');
Now you will be able to ALTER TABLE
Comments
Post a Comment