DB2日期自动转换成时间戳,是在后面加六个0吗,比如20140101,会变成20140101000000

数据库里面是14位的,我想直接用8位的日期作为条件,进行筛选数据

第1个回答  2014-11-07
>db2 "create table test123(aa timestamp)"
DB20000I The SQL command completed successfully.

>db2 "insert into test123 values (current timestamp)"
DB20000I The SQL command completed successfully.

>db2 "select * from test123 where date(aa)='2014-11-07'"

AA
--------------------------
2014-11-07-16.30.34.618413

1 record(s) selected.

>db2 "select date(aa) from test123 where date(aa)='2014-11-07'"

1
----------
2014-11-07

1 record(s) selected.追问

先谢谢你的回答。
比如:
createDate
20141009000000
20141011111111
20141030000000
20141031111111
createDate between '20141010' and '20141030'
结果应该是
20141011111111
20141030000000

本回答被提问者采纳