MySQL multiple TIMESTAMP error: There can is only one TIMESTAMP column with Current_timestamp

Source: Internet
Author: User

MySQL 5.6.5 The following version does not support multiple timestamp and is set to default Current_timestamp

The alternative is to use the trigger

 create TABLE ' example ' ('  id   "INTEGER UNSIGNED not NULL auto_increment, ' created ' TIMESTAMP not null DEFAULT current_timestamp , ' lastupdated ' DATETIME not NULL, PRIMARY KEY ('   // create TRIGGER ' Insert_example_trigger ' before insert On ' example ' for each ROW SET NEW. ' lastupdated '  = now () 
create TRIGGER ' Update_example_trigger ' before update on ' example '
for each ROW SET NEW. ' LastUpdated ' = now () // DELIMITER;

Trigger is associated with a table, and if the table is deleted, trigger is not

Insert, UPDATE, delete three behaviors can only correspond to a maximum of one trigger

Reference documents:

Http://www.jb51.net/article/50878.htm

Https://www.cnblogs.com/lmule/archive/2010/09/28/1837303.html

Https://www.cnblogs.com/nicholas_f/archive/2009/09/22/1572050.html

MySQL multiple TIMESTAMP error: There can is only one TIMESTAMP column with Current_timestamp

Related Article

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.