Friends,
This is my first post and I'm new to DB2. Hopefully somebody would be able to point me in the right direction. Before I post my problem here is a snapshot of the environment:
IBM DB2 Universal Database Version 8
Level: DB2 v8.1.9.700
Build level: s050422
Product identifier: SQL08022
Problem:
This is an old application which needs some repair work. Language used is ASP(VB6) and database is DB2. I'm trying to display date fields and update them with a submit button. The Date columns in DB2 are of type DATE. There is also a TIMESTAMP column to determine the exact time of the update which is also updated with the submit button. To display the dates presently i'm using a function called GetRs. The query goes like this:
strSql = "SELECT a.PNUM, CASE CHAR(a.REF_DT) WHEN '0001-01-01' THEN '' ELSE CHAR(a.REF_DT) END R_DT , "
and so forth
The default values in the DATE columns are 1-01-01 and notnull.
The display(GetRs) works ok. But when I try to update the dates, the Recordset.UpdateBatch throws error - SQLCODE 180. And I think this is due to the incorrect DATE/CHAR conversion that I've implemented.
The client side script is designed to pass the date values in the format of 'Year-Month-Day' and this format is passed to the sql string.
I searched this forum and found few similar threads but couldn't implement them in my code.
I've tried using CAST, DATE(), DT() etc from the page below -
Who can help me to translate SQL Server query to DB2?
I would appreciate it if somebody could look into the issue and point me in the right direction. If you need more information please let me know.
Thanks,
Optimus