MySQL-' lasttime'的默认值无效

时间:2017-01-21 15:31:37

标签: mysql

SQL sorgusu:

CREATE TABLE online(

idonline İNT( 10 ) UNSİGNED NOT NULL AUTO_INCREMENT ,
ip VARCHAR( 16 ) ,
domain VARCHAR( 100 ) ,
FKiduyeler İNT( 10 ) UNSİGNED,
lasttime TİMESTAMP DEFAULT  'CURRENT_TIMESTAMP',
PRIMARY KEY ( idonline ) ,
KEY online_index3587( ip ) ,
KEY online_index3588( domain ) ,
KEY online_index3592( FKiduyeler ) ,
KEY online_index3604( lasttime )
);

MySQL çıktısı: Belgeler

#1067 - Invalid default value for 'lasttime' 

在对我的英语感到遗憾之前;当我上传我的数据库时,我得到了这个proglem。请帮帮我。谢谢

2 个答案:

答案 0 :(得分:1)

  • CURRENT_TIMESTAMP代替'CURRENT_TIMESTAMP'
  • 在多个地方
  • I而不是İ
CREATE TABLE `online`(

idonline INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
ip VARCHAR( 16 ) ,
domain VARCHAR( 100 ) ,
FKiduyeler INT( 10 ) UNSIGNED,
lasttime TIMESTAMP DEFAULT  CURRENT_TIMESTAMP, -- lose the single quotes here
PRIMARY KEY ( idonline ) ,
KEY online_index3587( ip ) ,
KEY online_index3588( domain ) ,
KEY online_index3592( FKiduyeler ) ,
KEY online_index3604( lasttime )
);

答案 1 :(得分:0)

感谢您的帮助,但是当我这样做时,我遇到了这个问题:

  

CREATE TABLE visitor_chats(visitor_id varchar(32)NOT NULL,   browser_id varchar(32)NOT NULL,visit_id varchar(32)NOT NULL,   chat_id int(11)unsigned NOT NULL,fullname varchar(255)NOT NULL,   email varchar(255)NOT NULL,company varchar(255)NOT NULL,status   tinyint(1)unsigned NOT NULL,输入tinyint(1)unsigned NOT NULL,   waiting tinyint(1)unsigned NOT NULL,area_code varchar(255)NOT NULL,   first_active int(10)unsigned NOT NULL,last_active int(10)unsigned   NOT NULL,qpenalty int(10)unsigned NOT NULL,request_operator   varchar(32)NOT NULL,request_group varchar(32)NOT NULL,question   varchar(255)NOT NULL,海关文本NOT NULL,分配int(11)   unsigned NOT NULL,internal_active tinyint(1)unsigned NOT NULL,   internal_closed tinyint(1)unsigned NOT NULL,internal_declined   tinyint(1)unsigned NOT NULL,external_active tinyint(1)unsigned NOT   NULL,external_close tinyint(1)unsigned NOT NULL,退出int(11)[...]

MySQL错误

  

"#1064 - 您的SQL语法出错;检查手册   对应于您的MySQL服务器版本,以便使用正确的语法   near' exit int(11)unsigned NOT NULL,PRIMARY KEY   (visitor_id,browser_id,visit_id,c'在第26行和第34行;