SQL错误-#1293-错误的表格定义;

时间:2019-08-05 16:49:50

标签: sql

使用CreationDateUpdationDate列创建一个表。报告的错误是,只有一列可以是TIMESTAMP类型并使用CURRENT_TIMESTAMP。正确的语法是什么?

Image from MySQL

    create table tbladmin (
    id INT(11) NOT NULL,
    AdminUserName VARCHAR(255) NOT NULL,
    AdminPassword VARCHAR(255) NOT NULL,
    AdminEmailId VARCHAR(255) NOT NULL,
    Is_Active INT(11) NOT NULL,
    CreationDate timestamp NOT NULL  DEFAULT 'CURRENT_TIMESTAMP'
    UpdationDate timestamp NULL ON UPDATE 'CURRENT_TIMESTAMP'
    ) ENGINE = INNODB DEFAULT CHARSET = latin1;

来自MySQL的错误消息:

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

1 个答案:

答案 0 :(得分:0)

尝试将CreationDateUpdateDate列更改为datetime()类型,而不是timestamp