MariaDB社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 5491|回复: 3
打印 上一主题 下一主题

mysql 的getdate()问题

[复制链接]
跳转到指定楼层
1#
发表于 2009-8-31 13:00:33 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
请大侠帮我看看,这个语句死活调不通:


create table orders(

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


就是getdate()这块老有问题
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏1 转播转播 分享分享 分享淘帖 顶 踩
4#
发表于 2009-9-1 10:16:00 | 只看该作者
依据:
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.
3#
 楼主| 发表于 2009-9-1 10:07:49 | 只看该作者
2# kider


谢谢老哥
2#
发表于 2009-9-1 09:33:18 | 只看该作者
不能用getdate(),如果想要默认值为当前时间,用timestamp吧
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|手机版|MariaDB社区 ( 京ICP备07012489号    |
业务联系: QQ:48474881; 邮箱: 48474881@qq.com; 电话:13911732319
声明:本站部分文章是网友转载,若未经作者同意或署名有误,请联系网站管理员。

GMT+8, 2024-9-20 06:06 , Processed in 0.060870 second(s), 20 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表