如何设置 Mysql中的datetime的默认值
1个回答
推荐于2016-02-03
展开全部
在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');
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');
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询