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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC Query working with DATES.

Status
Not open for further replies.

Pinball4ever

Programmer
Oct 7, 2005
1
NL
Hi all,

I've been working with a query with ODBC (32-bits) connecting through a DB2/AS400 database.

I have certain records of the database, but now i want to check the mutation date (mutmutdat) with the current date.
(with ODBC-SQL).

However my query WHERE MUTMUTDAT = CURDATE() isn't working since the output of MUTMUTDAT = yyyymmdd

CURRENTDATE or CURDATE is just showing '7/10/2005'.
Also the CONVERT command doesn't work.

Who can help me out ?? Or having tips to handle date's compared with the system date.

Thanks all !

Best Regards,
Alex


 
You need to convert MUTMUTDAT from DECIMAL to a DATE type.
Try something like

WHERE
CAST(CAST(CONCAT(CAST( MUTMUTDAT AS CHAR(8) ) , '000000') AS TIMESTAMP) AS DATE) = CURDATE()


If fishing was easy it would be called catching
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top