MariaDB社区

标题: mysql 的getdate()问题 [打印本页]

作者: gaofengai8    时间: 2009-8-31 13:00
标题: mysql 的getdate()问题
请大侠帮我看看,这个语句死活调不通:


create table orders(

ordersId bigint auto_increment ,
orderDate date  default getdate() ,
totalPrice float not null,
primary key (ordersId)
);
commit;


就是getdate()这块老有问题
作者: kider    时间: 2009-9-1 09:33
不能用getdate(),如果想要默认值为当前时间,用timestamp吧
作者: gaofengai8    时间: 2009-9-1 10:07
2# kider


谢谢老哥
作者: kider    时间: 2009-9-1 10:16
依据:
The DEFAULT clause specifies a default value for a column. With one exception, the default value must be a constant; it cannot be a function or an expression. This means, for example, that you cannot set the default for a date column to be the value of a function such as NOW() or CURRENT_DATE. The exception is that you can specify CURRENT_TIMESTAMP as the default for a TIMESTAMP column.




欢迎光临 MariaDB社区 (http://123.56.88.72/) Powered by Discuz! X3.2