from:http://blog.csdn.net/zht666/article/details/10373923
方法
alter table tablename
column TIMESTAMP NOT NULL DEFAULT ‘0000-00-00 00:00:00′
关于timestamp初始化时,不同的参数的结果如下:
初始化代码
CREATE TABLE cd00_feihu( t1 TIMESTAMP, t2 TIMESTAMP NOT NULL, t3 TIMESTAMP DEFAULT 0, t4 TIMESTAMP ) 执行后,表的SQL代码将会变成下面的样子 CREATE TABLE cd00_feihu( t1 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, t2 TIMESTAMP NOT NULL DEFAULT ‘0000-00-00 00:00:00′, t3 TIMESTAMP NOT NULL DEFAULT ‘0000-00-00 00:00:00′, t4 TIMESTAMP NOT NULL DEFAULT ‘0000-00-00 00:00:00′ ) ENGINE=INNODB DEFAULT CHARSET=gbk
|