informix query header
Posted in 2009
Topics: Migration, Import/Export & Data Conversion
Hi Is there a way in informix SQL where i can print the header (column names) in my report output. just like oracle has set header on or off. i know it is not there in ids7.3 or 9.4. but after that has informix introduced any solution for this? something like unload to filename select * from tablename would give me column names in the first row.. -- Thanks & Regards Debadatta Mishra --0016368e27049b07e70478a2a12d
Download Jonathan Leffler's sqlcmd utility. It can optionally unload adding
a column name row and even, if you want, a data type row, to the output. It
can also unload in XML format, fixed column format, CSV format (eliminates
the trailing comma you get from dbaccess if you just change the DELIMITER to
comma), and others. Sqlcmd also comes with lots of other nice features,
including command line unloader and loader and upsert utilities and a server
mode that makes shell scripting SQL much easier and faster. Sqlcmd is in
the IIUG Software Repository (www.iiug.org/software) from which you can
download it for free.
Art
Art S. Kagel
Oninit (www.oninit.com)
IIUG Board of Directors (art@iiug.org)
Disclaimer: Please keep in mind that my own opinions are my own opinions and
do not reflect on my employer, Oninit, the IIUG, nor any other organization
with which I am associated either explicitly or implicitly. Neither do
those opinions reflect those of other individuals affiliated with any entity
with which I am affiliated nor those of the entities themselves.
On Wed, Nov 18, 2009 at 5:23 AM, debadatta <mishra.dd@gmail.com> wrote:
> Hi
>
> Is there a way in informix SQL where i can print the header (column names)
> in my report output.
>
> just like oracle has set header on or off.
>
> i know it is not there in ids7.3 or 9.4. but after that has informix
> introduced any solution for this?
>
> something like unload to filename select * from tablename would give me
> column names in the first row..
>
> --
> Thanks & Regards
> Debadatta Mishra
>
> --0016368e27049b07e70478a2a12d
>
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
--00163646dbdc64f2710478a358b9
This has been there in dbaccess for a while, version 4 atleast.
OUTPUT TO [filename | pipe ] WITHOUT HEADINGS Select statement
OUTPUT TO [filename | pipe ] Select statement
John F. Miller III
STSM, Support Architect
miller3@us.ibm.com
503-578-5645
IBM Informix Dynamic Server (IDS)
ids-bounces@iiug.org wrote on 11/18/2009 02:23:22 AM:
> [image removed]
>
> informix query header [18141]
>
> debadatta
>
> to:
>
> ids
>
> 11/18/2009 02:24 AM
>
> Sent by:
>
> ids-bounces@iiug.org
>
> Please respond to ids
>
> Hi
>
> Is there a way in informix SQL where i can print the header (column
names)
> in my report output.
>
> just like oracle has set header on or off.
>
> i know it is not there in ids7.3 or 9.4. but after that has informix
> introduced any solution for this?
>
> something like unload to filename select * from tablename would give me
> column names in the first row..
>
> --
> Thanks & Regards
> Debadatta Mishra
>
> --0016368e27049b07e70478a2a12d
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
Not the question, John. The OP wants headers in a delimited UNLOAD file.
Art
Art S. Kagel
Oninit (www.oninit.com)
IIUG Board of Directors (art@iiug.org)
Disclaimer: Please keep in mind that my own opinions are my own opinions and
do not reflect on my employer, Oninit, the IIUG, nor any other organization
with which I am associated either explicitly or implicitly. Neither do
those opinions reflect those of other individuals affiliated with any entity
with which I am affiliated nor those of the entities themselves.
On Thu, Nov 19, 2009 at 5:19 PM, John Miller iii <miller3@us.ibm.com> wrote:
> This has been there in dbaccess for a while, version 4 atleast.
>
> OUTPUT TO [filename | pipe ] WITHOUT HEADINGS Select statement
> OUTPUT TO [filename | pipe ] Select statement
>
> John F. Miller III
> STSM, Support Architect
> miller3@us.ibm.com
> 503-578-5645
> IBM Informix Dynamic Server (IDS)
>
> ids-bounces@iiug.org wrote on 11/18/2009 02:23:22 AM:
>
> > [image removed]
> >
> > informix query header [18141]
> >
> > debadatta
> >
> > to:
> >
> > ids
> >
> > 11/18/2009 02:24 AM
> >
> > Sent by:
> >
> > ids-bounces@iiug.org
> >
> > Please respond to ids
> >
> > Hi
> >
> > Is there a way in informix SQL where i can print the header (column
> names)
> > in my report output.
> >
> > just like oracle has set header on or off.
> >
> > i know it is not there in ids7.3 or 9.4. but after that has informix
> > introduced any solution for this?
> >
> > something like unload to filename select * from tablename would give me
> > column names in the first row..
> >
> > --
> > Thanks & Regards
> > Debadatta Mishra
> >
> > --0016368e27049b07e70478a2a12d
> >
> >
> >
>
>
>
*******************************************************************************
>
> > Forum Note: Use "Reply" to post a response in the discussion forum.
> >
>
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
--00151747b74ac2b33d0478c41ac9
On Wed, Nov 18, 2009 at 02:23, debadatta <mishra.dd@gmail.com> wrote: > > Is there a way in informix SQL where i can print the header (column names) > in my report output. > DB-Access has the OUTPUT statement, which can do some of that. It has a tendency to wrap so that you have the column names down the left-hand side and the data on the right-hand side. Otherwise, as Art Kagel said, my SQLCMD program will give you column names (and types) on request. > just like oracle has set header on or off. > > i know it is not there in ids7.3 or 9.4. but after that has informix > introduced any solution for this? > > something like unload to filename select * from tablename would give me > column names in the first row.. > sqlcmd -d whatever -H -e 'select * from tablename' For types too, use '-T' (and drop the '-H' if you want types only). -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2008.0513 -- http://dbi.perl.org/ "Blessed are we who can laugh at ourselves, for we shall never cease to be amused." NB: Please do not use this email for correspondence. I don't necessarily read it every week, even. Pablo Picasso<http://www.brainyquote.com/quotes/authors/p/pablo_picasso.html> - "Computers are useless. They can only give you answers." --000e0cd29694133931047926a5d2