Re: Column names in unload
Posted in 2000
Topics: Migration, Import/Export & Data Conversion
With a few extra steps, if you know the column names you are selecting:
select "msg_type" msg_type,
"code " code,
"description " description
from systables
where tabid = 1
into temp tmp_tab with no log;
insert into tmp_tab
select msg_type, code, description
from trac_msg;
unload to tmp_tab.out
select *
from tmp_tab
You would get:
msg_type|code|description|
EGE|5001|There are no more rows in the direction you are going|
EGE|5002|There are no rows satisfying the conditions|
EGE|5003|There are no rows in the current list|
EGE|5004|The current row position contains a deleted row|
(The first record, the header field record, needs its literals to be padded
as long as the longest strings going into the table)
hktkenneth@my-deja.com wrote:
>
> Hi there,
>
> Is it possible to include the column names when I do a
> UNLOAD TO....SELECT.... statement?
>
> Thanks!
>
> Kenneth
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
>
--
Colin McGrath cmm@trac3000.ueci.com
Washington Group International, Inc. (215) 422-4144
Philadelphia, PA, USA
Any opinions I state are my own and not necessarily those of my employer
Colin,
there is no need to pad the heading. All you need is to pipe the unl
file through my utility script, beautify-unl.sh; this will allign all
the columns very nicely.
In the IIUG library, it got entered as beautify_unl.sh - with an
underscore(_) instead of the dash(-) I had named it with.
-- Helpful Jake.
In article <8q8jcf$qfn$1@news.xmission.com>,
Colin McGrath <cmm@trac3000.ueci.com> wrote:
>
> With a few extra steps, if you know the column names you are
> selecting:
>
> select "msg_type" msg_type,
> "code " code,
> "description " description
> from systables
> where tabid = 1
> into temp tmp_tab with no log;
>
> insert into tmp_tab
> select msg_type, code, description
> from trac_msg;>
> unload to tmp_tab.out
> select *
> from tmp_tab>
> You would get:
>
> msg_type|code|description|
> EGE|5001|There are no more rows in the direction you are going|
> EGE|5002|There are no rows satisfying the conditions|
> EGE|5003|There are no rows in the current list|
> EGE|5004|The current row position contains a deleted row|
>
> (The first record, the header field record, needs its literals to be
> padded as long as the longest strings going into the table)
>
> hktkenneth@my-deja.com wrote:
> >
> > Hi there,
> >
> > Is it possible to include the column names when I do a
> > UNLOAD TO....SELECT.... statement?
> >
> > Thanks!
> >
> > Kenneth
> >
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> >
> >
>
> --
> Colin McGrath cmm@trac3000.ueci.com
> Washington Group International, Inc. (215) 422-4144
> Philadelphia, PA, USA
> Any opinions I state are my own and not necessarily those of my
employer
>
--
+----- Jacob Salomon - DBA JSalomon@bn.com - --------------------------+
|------------------- Bulletin Board Announcement ----------------------|
| Congregants will please note that the bowl at the back of the church |
| bearing the sign "For the Sick" is for monetary contributions only. |
Sent via Deja.com http://www.deja.com/
Before you buy.