MySQL Import data error 1067 (42000) Invalid default value for ' Update '

Source: Internet
Author: User

Problem Description: Error 1067 occurred while MySQL was importing data.

1 first find the line to be faulted: CREATE TABLE ' Fct_sales ' (

' UpdateTime ' datetime not NULL DEFAULT current_timestamp COMMENT ' update Time ') Engine=innodb DEFAULT Charset=utf8;

2 Searching for datetime and CURRENT_TIMESTAMP usage

3 Modify Datetime--timestamp or delete default Current_timestamp

4 successful

Cause: datetime date function, save date only. It is appropriate to record the original creation time of the data, because no matter how you change the value of the other fields in the record, the value of the DateTime field does not change unless you manually change it.

Timestamp timestamp to record the last modified time. You can set the TIMESTAMP not to update automatically, by setting the default Current_timestamp can be implemented.

The timestamp type is appropriate for recording the last modification time of the data, because the value of the timestamp field is automatically updated as soon as you change the value of the other fields in the record. (if necessary, you can set timestamp not update automatically)

MySQL Import data error 1067 (42000) Invalid default value for ' Update '

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.