开发者

Sybase: Composing a WHERE for a timestamp datatype

开发者 https://www.devze.com 2023-03-14 16:48 出处:网络
I\'m trying to compose a SQL Select statement for Sybase with a Where clause on Timestamp datatype. 开发者_JAVA技巧

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

精彩评论

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