Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Column delimiter

0 views
Skip to first unread message

harry smith

unread,
Apr 25, 2002, 3:46:38 PM4/25/02
to
How can I specify column delimiter while selecting data from a table?

lsu...@mb.sympatico.ca

unread,
Apr 25, 2002, 4:23:13 PM4/25/02
to
On Thu, 25 Apr 2002 19:46:38 UTC, "harry smith" <hry...@hotmail.com>
wrote:

> How can I specify column delimiter while selecting data from a table?

Are you talking about using one of the utilities for import/export?

A regular select statement will put the data into an appropriate host
variable. Are you talking about some way of limiting the data that
goes into the host variable?

Something like

select substr(c1, 1, locate(' ', c1)) from sometable ?

I tried the following on the sample database and it worked

select substr(firstnme, 1, locate('N', firstnme)) from employee

You could replace "N" with the delimiter of your choice.

--
Lorne Sunley

Knut Stolze

unread,
Apr 25, 2002, 4:37:24 PM4/25/02
to
On Thu, 25 Apr 2002 14:46:38 -0500, harry smith wrote:
> How can I specify column delimiter while selecting data from a table?

What do you want to do? Do you have an example? Are you using some sort of
programming language? Then you usually retrieve the columns into separate
variables. Do you want to EXPORT data? Then you have the COLDEL option.

--
Knut Stolze
DB2 Spatial Extender
IBM Silicon Valley Lab

harry smith

unread,
Apr 26, 2002, 11:10:48 AM4/26/02
to
I have two cases
case1

db2 "select * from zipcode" >output.out

case2

db2 list applications show detail > output.out2


"Knut Stolze" <sto...@us.ibm.com> wrote in message
news:slrnacgq84...@stolze.svl.ibm.com...

Knut Stolze

unread,
Apr 26, 2002, 12:37:50 PM4/26/02
to
On Fri, 26 Apr 2002 10:10:48 -0500, harry smith wrote:
> I have two cases
> case1
>
> db2 "select * from zipcode" >output.out
>
> case2
>
> db2 list applications show detail > output.out2

Sorry, but I still don't understand what you want to do. Both statements
have a similar output (at least on my system). Could you explain what you
get and what you want to get?

I assume that you run the statement on the command line. Given that, you
can use any scripting language or tool (Perl, awk, sed, ...) to format the
output in any way you like.

Besides, one is a SQL statement that selects data from a table, the other is
a db2 command (not an SQL statement) that retrieves some other information,
which are not in a table in the database.

0 new messages