Redian新闻
>
How to insert CURRENT TIMESTAMP into sql
avatar
How to insert CURRENT TIMESTAMP into sql# Database - 数据库
a*s
1
i followed example but it doesn't accept, always say there is error parse near
TIMESTAMP, pls. help me and tell me what the problem is.
I did:
INSERT INTO items VALUES(......,CURRENT TIMESTAMP,...);
The attribute has been set to be TIMESTAMP when i created this table.
Why I can't insert CURRENT TIMESTAMP?
avatar
s*i
2
not sure which database you are using, but
try CURRENT_TIMESTAMP

【在 a**********s 的大作中提到】
: i followed example but it doesn't accept, always say there is error parse near
: TIMESTAMP, pls. help me and tell me what the problem is.
: I did:
: INSERT INTO items VALUES(......,CURRENT TIMESTAMP,...);
: The attribute has been set to be TIMESTAMP when i created this table.
: Why I can't insert CURRENT TIMESTAMP?

avatar
n*m
3
It should be CURRENT TIMESTAMP if you use DB2. I just tried it on my Machine.
and works.

【在 s**********i 的大作中提到】
: not sure which database you are using, but
: try CURRENT_TIMESTAMP

avatar
a*s
4
It's PostgreSQL... it doesn't work...
Machine.
parse near
avatar
s*i
5
postgresql manual says:
The following functions are available to obtain the current date and/or time:
CURRENT_DATE
CURRENT_TIME
CURRENT_TIMESTAMP
CURRENT_TIME ( precision )
CURRENT_TIMESTAMP ( precision )
The function now() is the traditional PostgreSQL equivalent to
CURRENT_TIMESTAMP.

【在 a**********s 的大作中提到】
: It's PostgreSQL... it doesn't work...
: Machine.
: parse near

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。