If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > db2 timestamp format not loading

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-19-11, 12:27
kristo5747 kristo5747 is offline
Registered User
 
Join Date: Jul 2003
Location: Los Angeles
Posts: 12
db2 timestamp format not loading

I am trying to bulk-load data with timestamps into DB2 UDB version 9 and it is not working out.

My target table has been created thusly

Code:
    CREATE TABLE SHORT
    (
     ACCOUNT_NUMBER INTEGER 
    , DATA_UPDATE_DATE TIMESTAMP DEFAULT current timestamp
    , SCHEDULE_DATE TIMESTAMP DEFAULT current timestamp
    ...
    0)
This is the code for my bulk load

Code:
    load from /tmp/short.csv of del modified by COLDEL, savecount 500 messages /users/chris/DATA/short.msg INSERT INTO SHORT NONRECOVERABLE DATA BUFFER 500
No rows are loaded. I get an error

Code:
    SQL0180N  The syntax of the string representation of a datetime value is 
    incorrect.  SQLSTATE=22007
I tried forcing the timestamp format when I create my table thusly:

Code:
    CREATE TABLE SHORT
    (
     ACCOUNT_NUMBER INTEGER 
    , DATA_UPDATE_DATE TIMESTAMP DEFAULT 'YYYY-MM-DD HH24:MI:SS' 
    , SCHEDULE_DATE TIMESTAMP DEFAULT 'YYYY-MM-DD HH24:MI:SS' 
    ...
    0)
but to no avail:
Code:
SQL0574N  DEFAULT value or IDENTITY attribute value is not valid for column
.

Timestamp format in source my data file looks like this

Code:
    2002/06/18 17:11:02.000
How can I format my timestamp columns?
Reply With Quote
  #2 (permalink)  
Old 09-19-11, 12:46
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Read the manual on the LOAD command and look for the MODIFIED BY TIMESTAMPFORMAT clause.

Andy
Reply With Quote
  #3 (permalink)  
Old 09-19-11, 14:27
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Timestamp data is always stored the same way in an internal DB2 format, so don't try and modify the create table statement. As mentioned by ARWinner, you need to do more research on how to specify format for load command (or format you want when you query the data).
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On