满意答案
YIQING063
2014.12.03
采纳率:57% 等级:9
已帮助:316人
在sqlserver2000中可以这样
create table test(name varchar(10),registerTime datetime default getdate());
设置默认值。但在MySQ中
create table test(name varchar(10),registerTime datetime default now());
ERROR 1064: You have an error in your SQL syntax. Check the manual that corresp
onds to your MySQL server version for the right syntax to use near 'now()
)' at line 2
如何在MySQL中设置datetime型的当前默认值? [Re: jingang] Copy to clipboard
Posted by: wanghb507
Posted on: 2004-03-02 10:25
我看只能,在程序上处理了,因为在
insert into test values('name', now());
中是正确的
如何在MySQL中设置datetime型的当前默认值? [Re: jingang] Copy to clipboard
Posted by: NcitZhang
Posted on: 2004-03-28 18:10
create table test(name varchar(10),registerTime datetime default getdate());
create table test(name varchar(10),registerTime datetime default '0000-00-00');
00分享举报