高手热心人来看看,该如何处理

高手热心人来看看

— 这条SQL为什么运行不了?错误好像是1064 

— MYSQL 5.1, WinXP

SQL code


  

--use dbtest;

create table msgs(
 msgid int auto_crement not null,
 title varchar(20) not null,
 email varchar(40),
 msgtext text not null,
 primary key(msgid)
);


/* 
* 另外我想问下, 如果我想在表中添加一个msgtime, 此字段根据消息生成的系统时间而生成, 这个sql该怎么写? 
* 又如果把它存储成字符串20120112185530那SQL该怎么写呢
*/ 


SQL code

mysql> create table msgs(
    ->  msgid int [color=#FF0000]auto_increment[/color] not null,
    ->  title varchar(20) not null,
    ->  email varchar(40),
    ->  msgtext text not null,
    ->  primary key(msgid)
    -> );
Query OK, 0 rows affected (0.08 sec)

mysql> alter table msgs add msgtime timestamp DEFAULT CURRENT_TIMESTAMP;
Query OK, 0 rows affected (0.28 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> insert into msgs values(null, 'abc', 'a@a.com', 'no content', null);
Query OK, 1 row affected (0.03 sec)


                        
  
  
                    
高手热心人来看看,该如何处理

相关文章:

你感兴趣的文章:

标签云: