create table tb_topic(
id int(4)  auto_increment primary key not null,
content text,
author varchar(20) not null,
submittime timestamp(8) default current_timestamp,
forumid int(4) default 0,
title varchar(300) not null,
xq varchar(30) not null,
rq int(4) default 0,
forumname varchar(20)
);submittime timestamp(8) default current_timestamp,
这一句怎么老是报错??

解决方案 »

  1.   

    语句执行如下,没有任何问题。mysql> create table tb_topic(
        -> id int(4)  auto_increment primary key not null,
        -> content text,
        -> author varchar(20) not null,
        -> submittime timestamp default current_timestamp,
        -> forumid int(4) default 0,
        -> title varchar(300) not null,
        -> xq varchar(30) not null,
        -> rq int(4) default 0,
        -> forumname varchar(20)
        -> );
    Query OK, 0 rows affected (0.20 sec)mysql>
      

  2.   

    我的是这样的:======
    mysql> create table tb_topic(
        -> id int(4)  auto_increment primary key not null,
        -> content text,
        -> author varchar(20) not null,
        -> submittime timestamp(8) default current_timestamp,
        -> forumid int(4) default 0,
        -> title varchar(300) not null,
        -> xq varchar(30) not null,
        -> rq int(4) default 0,
        -> forumname varchar(20)
        -> );
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(8) default current_timestamp,
    forumid int(4) default 0,
    title varchar(300) not ' at line 5
      

  3.   

    你把submittime timestamp(8) default current_timestamp,
    变成了
    submittime timestamp default current_timestamp,
      

  4.   

    我看别人的脚本里有这个,我一运行就出错,他的脚本里其他地方也用到这个timestamp()没出错,就这儿,我想问问为啥。