| View previous topic :: View next topic |
| Author |
Message |
Rmravi Beginner
Joined: 24 Jun 2004 Posts: 12 Topics: 5
|
Posted: Thu Jul 15, 2004 12:50 am Post subject: help in sql |
|
|
I am extracting the data from the table A using the following query.
select * from A;
Result will be like this:
x y z
-------
1 2 3
4 5 5
a b c
But I need the column delimiter '|' between the two columns. I need the ruslt like this
1|2|3
4|5|5
a|b|c
If I write the query like this I can get the above result. |
|
| Back to top |
|
 |
NutCracker Beginner

Joined: 13 Dec 2002 Posts: 45 Topics: 3 Location: 3rd Block from the SUN
|
Posted: Thu Jul 15, 2004 1:18 am Post subject: |
|
|
| Code: |
SELECT X || '|' AS X, Y || '|' AS Y, Z || '|' AS Z
FROM A;
|
gives the output as you need.
| Code: |
X|Y|Z
----+-
1|2|3
4|5|5
a|b|c
|
|
|
| Back to top |
|
 |
Rmravi Beginner
Joined: 24 Jun 2004 Posts: 12 Topics: 5
|
Posted: Thu Jul 15, 2004 1:41 am Post subject: |
|
|
| But I don't want to select the column list manually in the selection list. (In the real database I am having around 100 columns with different data type). |
|
| Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12401 Topics: 75 Location: San Jose
|
|
| Back to top |
|
 |
Rmravi Beginner
Joined: 24 Jun 2004 Posts: 12 Topics: 5
|
Posted: Thu Jul 15, 2004 5:42 am Post subject: |
|
|
| Thanks Kolusu |
|
| Back to top |
|
 |
Bithead Advanced

Joined: 03 Jan 2003 Posts: 550 Topics: 23 Location: Michigan, USA
|
Posted: Thu Jul 15, 2004 7:58 am Post subject: |
|
|
| You could always run program DSNTEP2 - this gives you similar results. |
|
| Back to top |
|
 |
|
|
|