DB2 update query giving error STRING REPRESENTATION OF DATETIME VALUE HAS INVALID SYNTAX.

455 pts.
Tags:
DB2
DB2 Universal Database
DB2 Update Query
The following sql query in DB2 is giving the exception. What can be the correct query for this in DB2? SQLQuery=update EMP set validityenddate='01-JAN-07' WHERE username='XYZ' Exception: msg=java.sql.SQLException: [DataDirect][ODBC DB2 Wire Protocol driver][UDB DB2 for Windows, UNIX, and Linux]STRING REPRESENTATION OF DATETIME VALUE HAS INVALID SYNTAX.
ASKED: November 13, 2008  1:24 PM
UPDATED: December 4, 2008  1:49 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

The default date format depends on the territory code of the database, so for example, if the territory was set to US, the date format should be mm/dd/yyyy.

Have a look at <a href=”http://www.ibm.com/developerworks/db2/library/techarticle/0211yip/0211yip3.html”>this article</a> which explains, among other things, how to change the default date format.

You also have to note the datatype for this field on the database table EMP.
If the data type is TIMESTAMP, then the only correct way to set this column is by using the following format:
‘YYYY-MM-DD-hh.mm.ss.000000′ where 000000 correspond to the fractions of second.
If the data type is DATE then you should attain to the territory code of the database.
To get the territory code of the database, the database administrator should run the following command:
GET DATABASE CONFIGURATION FOR <database-alias>

To get the table definition the developer can run the following command, from the Command Center or the Command Window:
DESCRIBE TABLE EMP

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following