|
View previous topic :: View next topic
|
| Author |
Message |
sonali12_9
New User
Joined: 13 Feb 2009 Posts: 20 Location: United States of america
|
|
|
|
I am retrieving the data from db2 table.
one of the field (length is 30) can have values like
a.) asfshf
b.) "jdfhsjf,jfhf"
I need to send the retrieved data to comma separated file.
for first type value , my output is having "asfshf"
for second type of value , my output will have ""jdhsjf,jfhf" ",
If i try to retrieve value from spufi it will return "jdhsjf,jfhf "
i want single quotes for second type of value. Please suggest if it is possible to get data without quotes while retrieving from db2 table itself.
Thanks in advance for help |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
| post the query you are using... and sample columns values in the table... |
|
| Back to top |
|
 |
sonali12_9
New User
Joined: 13 Feb 2009 Posts: 20 Location: United States of america
|
|
|
|
| Code: |
SELECT * FROM ISDBA.table1;
ACN REC_TYPE CUST_ NAM
------+---------+---------+---------+---------+---------+-
14 07 JDE PURPOSES ONLY
27197 01 "PRICKETTS DISTRIBUTING, INC." |
|
|
| Back to top |
|
 |
sonali12_9
New User
Joined: 13 Feb 2009 Posts: 20 Location: United States of america
|
|
|
|
| first field ACN is 9(09). second is char (02). cust_name is char 30 |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
What would be expected output for about data?
would it be..
| Code: |
14 07 JDE PURPOSES ONLY
27197 01 PRICKETTS DISTRIBUTING, INC.
|
|
|
| Back to top |
|
 |
sonali12_9
New User
Joined: 13 Feb 2009 Posts: 20 Location: United States of america
|
|
|
|
| yeah , thats what i am expecting. |
|
| Back to top |
|
 |
sonali12_9
New User
Joined: 13 Feb 2009 Posts: 20 Location: United States of america
|
|
|
|
i can do it by
INSPECT OUT-RECord
REPLACING ALL '"' BY ' ' .
Please let me know if there any other way. |
|
| Back to top |
|
 |
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
| What about the sql translate function. |
|
| Back to top |
|
 |
Marso
REXX Moderator

Joined: 13 Mar 2006 Posts: 1356 Location: Israel
|
|
|
|
I just played a bit with a sample csv file and got interesting results:
| Code: |
1,AA,aa
2,AD,bb
3,AJ,"cc,ee"
4,AM,dd
5,BC, gg
6,BF, "hh,kk"
7,BK, 'jj,mm'
8,BO, 'pp,rr' |
Line 3: quoted text correctly loaded in one cell, double quotes have been removed.
Line 6: quoted text loaded in 2 cells, 1st part is "hh second part is kk"
Line 7: quoted text loaded in 2 cells, 1st part is 'jj 2nd part is mm'
Line 8: also loaded in 2 cells.
In lines 5 to 8, the leading space becomes part of the cell value.
I hope you can deduce by yourself what you need to do. |
|
| Back to top |
|
 |
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
| Code: |
| select replace(cust_nam,'"', '') from |
|
|
| Back to top |
|
 |
|
|