Home > Blockchain >  How to fix "1264 Out of range value for [date] column"?
How to fix "1264 Out of range value for [date] column"?

Time:07-28

When changing the engine of a table from MyISAM to InnoDB (by running "ALTER TABLE A ENGINE=InnoDB;"), it returned this warning: "1264 Out of range value for column" for a date column. I'm confused as according to the mysql doc, the date data type should have the same size. Can someone please help? The version of mysql is 5.7. Thanks!

Edit

Somehow it does not like '0000-00-00'

mysql> select * from test;

test_date
0000-00-00

1 row in set (0.00 sec)

mysql> alter table test engine=InnoDB; Query OK, 1 row affected, 1 warning (0.01 sec)

Records: 1 Duplicates: 0 Warnings: 1

CodePudding user response:

From the error message: one of the values in the column you are altering is out of range to be casted to a DATE.

From this answer it could be that the format of the value is not YYYY-MM-DD. So find out which value is that or change the column type to DATETIME.

  • Related