MySQL 5.4.6之前有关timestamp设置current_timestamp时报错there can be only one TIMESTAMP column with CURRENT_TI
来源:互联网 发布:笔记本清理垃圾软件 编辑:程序博客网 时间:2024/05/18 03:10
遇到的情况:
表中有多个timestamp类型的字段,最后一个使用current_timestamp()时报错:
there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause。
在网上看到有人说:(博客地址:http://blog.csdn.net/core_cto/article/details/8663056)
原因是当你给一个timestamp设置为on updatecurrent_timestamp的时候,其他的timestamp字段需要显式设定default值,但是如果你有两个timestamp字段,但是只把第一个设定为current_timestamp而第二个没有设定默认值,MySQL也能成功建表,但是反过来就不行...
在将最后一个timestamp字段移到前面使之成为第一个timestamp字段后,创建表成功。
CREATE TABLE seckill ( id BIGINT NOT NULL AUTO_INCREMENT COMMENT '商品库存ID', name VARCHAR(120) NOT NULL COMMENT '商品名称', number INT NOT NULL COMMENT '商品数量', create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP() COMMENT '创建时间', start_time TIMESTAMP NOT NULL COMMENT '秒杀开始时间', end_time TIMESTAMP NOT NULL COMMENT '秒杀结束时间', PRIMARY KEY (id), KEY idx_start_time (start_time), KEY idx_end_time (end_time), KEY idx_create_time (create_time))ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8 COMMENT = '秒杀库存库';
1 0
- MySQL 5.4.6之前有关timestamp设置current_timestamp时报错there can be only one TIMESTAMP column with CURRENT_TI
- there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
- there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
- error : Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in
- there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT
- mysql单表多timestamp报错#1293 - Incorrect table definition; there can be only one TIMESTAMP column with C
- 数据库建表 there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
- Mysql 1293 - Incorrect table definition; there can be only one TIMESTAMP column with C
- [Err] 1293 - Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTA
- 解决mysql的timestamp的only one current_timestamp限制
- MySQL错误TIMESTAMP column with CURRENT_TIMESTAMP的解决方法
- 创建主键时报错:ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it mus
- 创建主键时报错:ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it mus
- mysql timestamp/current_timestamp设置注意事项
- mysql timestamp/current_timestamp设置注意事项
- MySQL 数据表创建报错:there can be only one auto column and it must be defined as a key
- mysql报there can be only one auto column的问题原因
- mysql单表多timestamp的current_timestamp设置问题
- 网页制作规范和emmet常用快捷键
- Codeforces Round #410 (Div. 2)
- linux常用操作整理(资料来源于互联网,自己用)
- JSP简介及入门(含Eclipse for Java EE及Tomcat的配置)
- Java编程思想-08多态
- MySQL 5.4.6之前有关timestamp设置current_timestamp时报错there can be only one TIMESTAMP column with CURRENT_TI
- opencv---任务1
- 碎碎念-随笔-2017.04.22
- 论文阅读笔记-图像识别分类
- 全局K-means算法
- The service already exists!关于mysql 以zip安装解决
- HDOJ 1241 油田 DFS初级算法 java代码实现 详细注释
- 在 springmvc 中, 如何配置 fastjson (阿里开源的) 和 Jackson( Spring 内置的)
- 数字图像的几何运算