Unload
Posted in 2000
Topics: Migration, Import/Export & Data Conversion
If I do an unload to text file like
UNLOAD to items.unl
SELECT imast_item, imast_descext FROM imast
Can I get the unload file to include column headings?
Regards
Martyn
Martyn Shiner wrote:
> If I do an unload to text file like
>
> UNLOAD to items.unl
> SELECT imast_item, imast_descext FROM imast>
> Can I get the unload file to include column headings?
Depends on what you use. As standard, it's difficult. The
various UNION alternatives suggested by others will make all
output data into CHAR or VARCHAR columns, which probably won't
matter - but it might.
You might be able to use DB-Access or ISQL and the OUTPUT statement,
but it probably won't do the formatting the way you want (the story
of life with DB-Access).
If you've got SQLCMD from the IIUG archives, then the -H option turns
on column headings and the -T option turns on column types. This can
be used with sqlunload too. sqlreload does not ignore the first one or
two rows of data when those options are set, so assume that you won't be
able to load from the output format.
--
Yours,
Jonathan Leffler (Jonathan.Leffler@Informix.com) #include <disclaimer.h>
Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN
"I don't suffer from insanity; I enjoy every minute of it!"
Jonathan
We only have standard tools. From ISQL I guess I'm going to be forced to use
a union.
One thought - MS query returns the column headings if you, say, issue the
query from within Excel (which is the ultimate destination of this data).
Its just I wanted to do this on the server rather than mess with ODBC etc on
the client.
Regards
Martyn
Jonathan Leffler <jleffler@informix.com> wrote in message
news:395B9F7A.69466FF@informix.com...
> Martyn Shiner wrote:
> > If I do an unload to text file like
> >
> > UNLOAD to items.unl
> > SELECT imast_item, imast_descext FROM imast> >
> > Can I get the unload file to include column headings?
>
> Depends on what you use. As standard, it's difficult. The
> various UNION alternatives suggested by others will make all
> output data into CHAR or VARCHAR columns, which probably won't
> matter - but it might.
>
> You might be able to use DB-Access or ISQL and the OUTPUT statement,
> but it probably won't do the formatting the way you want (the story
> of life with DB-Access).
>
> If you've got SQLCMD from the IIUG archives, then the -H option turns
> on column headings and the -T option turns on column types. This can
> be used with sqlunload too. sqlreload does not ignore the first one or
> two rows of data when those options are set, so assume that you won't be
> able to load from the output format.
>
> --
> Yours,
> Jonathan Leffler (Jonathan.Leffler@Informix.com) #include <disclaimer.h>
> Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN
> "I don't suffer from insanity; I enjoy every minute of it!"
Martyn Shiner wrote: > > Jonathan > > We only have standard tools. From ISQL I guess I'm going to be forced to use > a union. No informix installation is complete without sqlcmd. You're missing a lot if you don't have sqlcmd. sqlcmd -H -d stores7 -e "select * from state" prints a header+rows. So installing "sqlcmd" (ftp://ftp.iiug.org/pub/informix/pub) is well worth the small effort.
Thanks for the info, I'll certainly check it out. Martyn David Stes <stes@pandora.be> wrote in message news:395CDA9F.A43F12C9@pandora.be... > Martyn Shiner wrote: > > > > Jonathan > > > > We only have standard tools. From ISQL I guess I'm going to be forced to use > > a union. > > No informix installation is complete without sqlcmd. You're missing a > lot if you don't have sqlcmd. > > sqlcmd -H -d stores7 -e "select * from state" prints a header+rows. > > So installing "sqlcmd" (ftp://ftp.iiug.org/pub/informix/pub) is well > worth the small effort.