开发者

Sybase: Composing a WHERE for a timestamp datatype

I'm trying to compose a SQL Select statement for Sybase with a Where clause on Timestamp datatype.

开发者_JAVA技巧
SELECT * FROM DEV.CONF WHERE LAST_UPDATE < '[some_date]'
  • The LAST_UPDATE column is the datatype Timestamp.
  • I've tried using the convert function and others but can't seem to get this to work.


AFAIK, the SQL standard specifies ISO 8601 format for timestamps so try this:

SELECT * FROM DEV.CONF WHERE LAST_UPDATE < '2011-06-16 04:17:29.463114'

where you want to use "04:17:29.463114 on June 16 2011" as your timestamp.

At the database level, you should only be using ISO 8601 date and time formats unless there is a very good reason for anything else (this part is just me being a bit opinionated though :).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜