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 > LOAD problem with coldel

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-20-03, 05:24
db2worker db2worker is offline
Registered User
 
Join Date: Jul 2003
Posts: 14
LOAD problem with coldel

Hi,

I tried to load a delimited text file to a table in DB2 v8. Data includes some double-quotes. For example,

123!"Hello"!"Wow" it is not ok!how "great"!oh "ohhhh" oh!that is all

with coldel=!

after loading such text file, and then select * from the table.

col1 col2 col3 col4 col5 col6
---------------------------------------------------------------------------
123 Hello Wow how "great" oh "ohhhh" oh that is all

Double-quotes in col2 and col3 disappeared!!!

And then i tried to use escape character "\"

123!\"Hello\"!\"Wow\" it is not ok!how \"great\"!oh \"ohhhh\" oh!that is all

col1 col2 col3 col4 col5 col6
-----------------------------------------------------------------------------------------
123 \"Hello\" \"Wow\" it is not ok how \"great\" oh \"ohhhh\" oh that is all

I suspect that if a field start with <!">, the system treat <"> as coldel instead of <!>. if a field start with <!> only, it works normally and double-quotes can be treated as part of the data.

Does any of u know how to fix this problem? Thx a lot!!
Reply With Quote
  #2 (permalink)  
Old 11-20-03, 05:48
jsander jsander is offline
Registered User
 
Join Date: Apr 2003
Posts: 191
Re: LOAD problem with coldel

Hi db2worker,

option chardel is your friend, not coldel.

By default, chardel is ", so the system considers any double quotes as string delimiters.

You may want to set chardel to some character that is just not going to be used in your data.
If you find that annoying, feel free to join in on my design change request with IBM (I want to be able to unset chardel, so it is not used at all). Got no response so far, but will continue to press on.

Johann

Quote:
Originally posted by db2worker
Hi,

I tried to load a delimited text file to a table in DB2 v8. Data includes some double-quotes. For example,

123!"Hello"!"Wow" it is not ok!how "great"!oh "ohhhh" oh!that is all

with coldel=!

after loading such text file, and then select * from the table.

col1 col2 col3 col4 col5 col6
---------------------------------------------------------------------------
123 Hello Wow how "great" oh "ohhhh" oh that is all

Double-quotes in col2 and col3 disappeared!!!

And then i tried to use escape character "\"

123!\"Hello\"!\"Wow\" it is not ok!how \"great\"!oh \"ohhhh\" oh!that is all

col1 col2 col3 col4 col5 col6
-----------------------------------------------------------------------------------------
123 \"Hello\" \"Wow\" it is not ok how \"great\" oh \"ohhhh\" oh that is all

I suspect that if a field start with <!">, the system treat <"> as coldel instead of <!>. if a field start with <!> only, it works normally and double-quotes can be treated as part of the data.

Does any of u know how to fix this problem? Thx a lot!!
Reply With Quote
  #3 (permalink)  
Old 11-20-03, 21:03
db2worker db2worker is offline
Registered User
 
Join Date: Jul 2003
Posts: 14
Johann,

it works now, thx.
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