Quote:
|
quote:The data types of the operands for the operation "BETWEEN" are not compatible.
|
I dont have DB2 environment to see how that works. Moreover I am not sure what it returns when CURRENT_DATE-1 is executed there. From the Error that you posted, all I can think of is that the CURRENT_DATE-1 OR CURRENT_DATE seems to be resulting different types of values which is not conforming with that of the the TableDateTime. Try and check if that is a possiblity for this error.
It is better to do the following from your OPENQUERY() and see if all the 3 return values of similar datatype.
SELECT CURRENT_TIMESTAMP -1 DAYS-0 HOURS, CURRENT_TIMESTAMP -1 DAYS, CURRENT_TIMESTAMP
I see "BETWEEN" missing in the below code...
(TableDateTime CURRENT_TIMESTAMP -1 DAYS-5 HOURS AND CURRENT_TIMESTAMP )
But the same being used in the other one. Is that you missed it by mistake? When you say this one works...then see if this helps...
CURRENT_TIMESTAMP -1 DAYS-0 HOURS
Cheers.
_________________________
- Vijay G
Strive for Perfection