Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to handle operators and dates

Status
Not open for further replies.

jisoo23

Programmer
Jan 27, 2004
192
0
0
US
Hey everyone,

This is probably a very easy question but for the life of me I can't find any examples to get me past this. Here is my query:

Code:
Select * from schema.table where schema.table.TS_LOAD > TIMESTAMP('2005-11-22');

When executing, I get an error back that says:

Code:
[IBM][CLI Driver][DB2] SQL0180N  The syntax of the string representation of a datetime value is incorrect.  SQLSTATE=22007

The TS_LOAD column is of the timestamp datatype, so I'm not sure why I'm getting this error?

Thanks in advance,
Jisoo23

 
you have to use:
TIMESTAMP('2005-11-23-00.00.00.000000')

try:
Code:
Select * from schema.table where table.TS_LOAD > TIMESTAMP('2005-11-23-00.00.00.000000');

Juliane
 
A second solution is to get the date portion of the column value and compare it to your value:
Code:
Select * from schema.table where DATE(table.TS_LOAD) > '2005-11-23';

Ever onward,
jar
 
Finally figured it out early this morning. I used this way:

Code:
select * from schema.table where table.TS_LOAD > TIMESTAMP('20051122000000');
{/code]

Thanks for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top