#1293 - Incorrect table definition; there can be only oneTIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause

1 CREATE TABLE `t_customer` (
`q_id` INT(11) NOT NULL AUTO_INCREMENT, `c_ctime` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ,
`c_uptime` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,

改成

     `c_ctime` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
`c_uptime` DATETIME NOT NULL,

然后加上触发器

CREATE TRIGGER `t_customer_uptime` BEFORE UPDATE ON `t_customer` FOR EACHROW SET NEW.`c_uptime` = NOW()

 CREATE TABLE `tb1` (
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`lastUpdated` DATETIME NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
DROP TRIGGER IF EXISTS `insert_example_trigger`;
DROP TRIGGER IF EXISTS `update_example_trigger`;
DELIMITER //
CREATE TRIGGER `insert_example_trigger` BEFORE INSERT ON `tb1`
FOR EACH ROW SET NEW.`lastUpdated` = NOW()
//
CREATE TRIGGER `update_example_trigger` BEFORE UPDATE ON `tb1`
FOR EACH ROW SET NEW.`lastUpdated` = NOW()
//
DELIMITER ;

												

mysql5.7 timestamp错误:there can be only oneTIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE的更多相关文章

  1. Mysql运行SQL文件 错误Incorrect table definition;there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause

    问题描述 想从服务器上DOWN下数据库.操作:先把数据库转存为SQL文件,然后在本地利用navicate运行SQL文件,出现错误信息: Incorrect table definition;there ...

  2. Mysql [Err] 1293 there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause

    问题: mysql数据 导入数据出错 [Err] 1293 - Incorrect table definition; there can be only one TIMESTAMP column w ...

  3. MySQL there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause同时创建多个更新当前时间戳字段 解决方法

    问题重现 在写这篇文章之前,明确我的MySQL版本,MariaDB 或者你使用 MySQL 8 也会出现如下问题 MySQL 版本 现在有这样的需求,一张表中有一个字段created_at记录创建该条 ...

  4. Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause

    错误描述 在DBeaver执行DDL语句时报错:SQL 错误 [1293] [HY000]: Incorrect table definition; there can be only one TIM ...

  5. msyql同步的时候报错 : 错误代码: 1293 Incorrect table definition;there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause

    场景,两个不同服务器上的数据库,进行数据库同步 但是执行之后,提示报错 错误代码: 1293 Incorrect table definition; there can be only one TIM ...

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

    一个表中出现多个timestamp并设置其中一个为current_timestamp的时候经常会遇到#1293 - Incorrect table definition; there can be o ...

  7. 1293 - Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause

    在数据库执行脚本文件时,执行到一半会遇到  这种问题: 出错处:2018-05-14 18:53:38 行号:712454 错误代码: 1293 - Incorrect table definitio ...

  8. there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause

    建表语句: create table test_table(   id integer not null auto_increment primary key,   stamp_created tim ...

  9. Mysql --- Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause

    我使用的5.5的mysql数据库会报这个错, 换成5.7的就可以了

随机推荐

  1. 寻找U2OS中表达的基因及其promoter并用于后续annotation

    方法1.RNA-seq得到不同表达程度基因 方法2. 直接download U2OS_gene.csv https://cancer.sanger.ac.uk/cell_lines/download ...

  2. [批处理] Git中log的使用

    1.获取两个提交之间的日志: git log SHA-1_A.. SHA-1_B--pretty=format:"%cd: %s" --date=format:%Y%m%d > ...

  3. JVM进程启动会启动哪些线程?

    首先要明白一点:JVM本身是一个多线程的程序,和我们编写的java应用程序一样,当JVM启动执行时就是在操作系统中启动了一个JVM进程.我们编写的java单线程或多线程应用进程都是在JVM这个程序中作 ...

  4. 第一个SDL程序

    不废话,就WinMain主体: SDL_Window* window = NULL; SDL_Renderer* renderer = NULL; SDL_Event e; bool q = 0; i ...

  5. IIS + FastCGI+php(从5.2升级到5.3)

    由于PHP5.3 的改进,原有的IIS 通过isapi 方式解析PHP脚本已经不被支持,PHP从5.3.0 以后的版本开始使用微软的 fastcgi 模式,这是一个更先进的方式,运行速度更快,更稳定. ...

  6. mysql_study_4

    索引 ALTER TABLE 表名字 ADD INDEX 索引名 (列名); CREATE INDEX 索引名 ON 表名字 (列名); 索引的效果就是加快查询速度,当表中数据不够多的时候是感受不出他 ...

  7. java线程学习之join方法

    join()方法表示一个线程要加入另一个线程,直到被加入的线程执行完毕. 这个概念不好理解的话看面这个例子 public class TestJoin { public static void mai ...

  8. hiho一下 第206周

    题目1 : Guess Number with Lower or Higher Hints 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 There is a game ...

  9. mysql中利用show profile很直观的看到查询缓存的作用。

    1.首先,开启mysql的查询缓存. 查看查询缓存情况: MariaDB [test]> show variables like '%query_cache%';+--------------- ...

  10. 读取本地json文件,并转换为dictionary

    // 读取本地JSON文件 - (NSDictionary *)readLocalFileWithName:(NSString *)name { // 获取文件路径 NSString *path = ...