Page 1 of 1

Updating DB2 server timestamp through Userdefined SQL

Posted: Mon Feb 23, 2009 7:23 am
by mchivuku
Hi ,

The requirement is to pass the Current timestamp value to the UPDATE_TIMESTAMP column, but to fetch its value from the DB2 server and not the DS server.So I have modified the update query as follows:

UPDATE #TargetSchemaName#.ARREARS_LETTER_INFORMATION SET LAST_ARREARS_LETTER_TYPE=?,LAST_ARREARS_LETTER_DATE=?,DELETE_FLAG=?,UPDATE_TIMESTAMP =
(select current timestamp from sysibm.sysdummy1) WHERE PART_KEY=? AND COMPANY_CD=? AND CUSTOMER_NBR=? AND BILLING_ITEM_NBR=? AND SEQUENCE_NBR=? AND COUNTRY_CD=?;

But this throws warnings as follows :

DSTAGE-DB2CLI-0103`:`Row rejected.
DBMS.CODE=-99999, SQLSTATE=22001, [IBM][CLI Driver] CLI0109E String data right truncation. SQLSTATE=2200

Also am unable to view data through this DB2 API stage.

Please give me your suggestions.

Regards,
Priya

Posted: Mon Feb 23, 2009 8:47 am
by DSguru2B
What happens when you just do UPDATE_TS = current timestamp ???

Posted: Tue Nov 10, 2009 7:08 am
by mchivuku
It throws the same error even when I use only current timestamp

Posted: Tue Nov 10, 2009 1:21 pm
by ray.wurlod
This is not a problem with the timestamp unless UPDATE_TIMESTAMP has a string data type. Please verify that. Otherwise, it is one of your Char or VarChar fields that is throwing this error. (The error message specifies "string data right truncation".)