1

I am trying to alter catalog_no, but while altering it I am getting error regarding 'date_available' column

My SQL for altering catalog_no is:

ALTER TABLE `product` CHANGE `catalog_no` `catalogno` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;

But this is giving me error #1067- Invalid default value for 'date_available'

What is the reason for this error and how can I solve it, Please help.

Thanks

Pankti Shah
  • 337
  • 6
  • 20

1 Answers1

5

The problem is because of sql_modes. Please check your current sql_modes by command:

show variables like 'sql_mode' ; 

And remove the sql_mode "NO_ZERO_IN_DATE,NO_ZERO_DATE" to make it work.

This is the default sql_mode in mysql new versions.

Source

Vijay Arun
  • 414
  • 8
  • 15