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 > Date formatting for DB2 load utility

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-21-07, 05:40
Shilpa.Bhat Shilpa.Bhat is offline
Registered User
 
Join Date: Dec 2007
Posts: 2
Date formatting for DB2 load utility

Hi,

I am trying to populate date and time into DB2 table using DB2 load utility script.

The date coming from source is in the format of YYYY-MM-DD(eg.2006-12-01) and the time in the form of hh:mm:ss

i am using the following utility script to perform the operation:

Code:
db2 LOAD CLIENT FROM <source filename> OF ASC modified by identitymissing dateformat="YYYY-MM-DD"  timeformat="HH:MM:SS"  
striptblanks reclen=32 method L (1 12,13 13,14 24,24 32) messages <error msg filename>INSERT INTO Table Name(Col1,Col2,Col3,Col4,Col5)
But this is giving a error :
SQL3192N In the filetmod a user specified format "DATEFORMAT" beginning with
the string "." is not valid.

Could you help me out with this.


Regards,
Shilpa Bhat
Reply With Quote
  #2 (permalink)  
Old 12-21-07, 11:38
fdegrijs fdegrijs is offline
Registered User
 
Join Date: Dec 2007
Location: Amsterdam, NL
Posts: 2
dear Shilpa.Bhat,

You should give all srings within single quotes, so '2007-12-21' would do it.

Regards,
FdeGrijs
Reply With Quote
  #3 (permalink)  
Old 12-24-07, 01:34
Shilpa.Bhat Shilpa.Bhat is offline
Registered User
 
Join Date: Dec 2007
Posts: 2
even after using single quotes 'YYYY-MM-DD',it still is giving the same error.

SQL3192N In the filetmod a user specified format "DATEFORMAT" beginning with
the string "." is not valid.
Reply With Quote
  #4 (permalink)  
Old 12-24-07, 10:25
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
I'm thinking that may be the quotation marks get interpreted by the shell. Try enclosing the entire DB2 command in quotes:
Code:
db2 "load client ... modified by dateformat=\"YYYYMMDD\" ..."
Reply With Quote
  #5 (permalink)  
Old 12-25-07, 09:09
Peter.Vanroose Peter.Vanroose is offline
Registered User
 
Join Date: Sep 2004
Location: Belgium
Posts: 1,079
Quote:
Originally Posted by n_i
I'm thinking that may be the quotation marks get interpreted by the shell.
Indeed; single quotes are even easier: (assuming this is a unix shell, not cmd.exe)
Code:
db2 'LOAD CLIENT FROM <source filename> OF ASC
     modified by identitymissing dateformat="YYYY-MM-DD"
     timeformat="HH:MM:SS" striptblanks reclen=32
     method L (1 12,13 13,14 24,24 32) messages <error msg filename>
     INSERT INTO Table Name(Col1,Col2,Col3,Col4,Col5)'
__________________
--_Peter Vanroose,
__IBM Certified Database Administrator, DB2 9 for z/OS
__IBM Certified Application Developer
__ABIS Training and Consulting
__http://www.abis.be/
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