码迷,mamicode.com
首页 > 数据库 > 详细

mysql单表多timestamp报错#1293 - Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause

时间:2018-04-20 14:33:51      阅读:240      评论:0      收藏:0      [点我收藏+]

标签:多个   解决办法   当前时间   刷新   ...   efault   ica   sql语句   tab   

一个表中出现多个timestamp并设置其中一个为current_timestamp的时候经常会遇到
#1293 - Incorrect table definition; there can be only oneTIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATEclause

原因是当你给一个timestamp设置为on updatecurrent_timestamp的时候,其他的timestamp字段需要显式设定default值

但是如果你有两个timestamp字段,但是只把第一个设定为current_timestamp而第二个没有设定默认值,mysql也能成功建表,但是反过来就不行...

 

 

N.B:红色的解释是网上的,实际上on updatecurrent_timestamp(在navicat中文版中为“刷新当前时间戳计时”选项)只能设置一个,或者不设置都可以,不能同时设置2个及以上。

解决办法

更改第二个类型运行完sql语句后更改过来

mysql单表多timestamp报错#1293 - Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause

标签:多个   解决办法   当前时间   刷新   ...   efault   ica   sql语句   tab   

原文地址:https://www.cnblogs.com/behindman/p/8890380.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!