455 pts.
 DB2 update query giving error STRING REPRESENTATION OF DATETIME VALUE HAS INVALID SYNTAX.
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.

Software/Hardware used:
ASKED: November 13, 2008  1:24 PM
UPDATED: December 4, 2008  1:49 AM

Answer Wiki:
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
Last Wiki Answer Submitted:  December 4, 2008  1:49 am  by  carlosdl   63,580 pts.
All Answer Wiki Contributors:  carlosdl   63,580 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _