Result of a select not as a table
Posted in 2009
Ralf found that in dbaccess a 5-column SELECT displayed as a normal table, but adding two more columns made the output switch to one field per line. Respondents explained this isn't a bug: dbaccess falls back to the vertical layout when the columns are too wide for the screen. Suggested workarounds: use a reporting tool (4GL/ACE), use UNLOAD TO a file (default '|' delimiter) and process it in a shell script, or shorten output with column aliases/expressions so the row fits in 80 characters.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: SQL Development & Query Writing
if i run this select statement
select lfdnr, udekz, stuelinr, mengealt, mengeneu from fkstpro
I get the result as a table
=>
lfdnr udekz stuelinr mengealt mengeneu
1 D 05340205200-0100 1,000 0,000
2 E 05340205204-0100 1,000 0,000
3 E 05340205200-0100 1,000 0,000
4 E 05710222800-0200 1,000 0,000
5 E 04910214801-0200 1,000 0,000
6 E 04910214801-0200 2,000 0,000
7 E 04910214801-0200 2,000 0,000
...
but with this statement
select lfdnr, udekz, stuelinr, matalt, mengealt, matneu, mengeneu
from fkstpro
I get this Result
lfdnr 1
udekz D
stuelinr 05340205200-0100
matalt 05340205203-0100
mengealt 1,000
matneu
mengeneu 0,000
lfdnr 2
udekz E
stuelinr 05340205204-0100
matalt 05340205203-0100
mengealt 1,000
matneu
mengeneu 0,000
lfdnr 3
udekz E
stuelinr 05340205200-0100
matalt 05340205204-0100
mengealt 1,000
matneu
mengeneu 0,000
....
How can I get the result as a table with the second sql statement?
Greating
Ralf
What are you using to run the query? dbaccess?
I suspect you are using dbaccess
The 1st query only has 5 columns so will easily fit in a tabular form
The 2nd query has 7 columns. I would suspect that dbaccess has worked
out the screen is not wide enough to display all the columns in a
table format hence the second format.
If you want to control the formating, use a reporting tool (4GL, ace)
On 10 Jul., 15:59, wcottishpoet <drybur...@yahoo.com> wrote:
> I suspect you are using dbaccess
>
> The 1st query only has 5 columns so will easily fit in a tabular form
>
> The 2nd query has 7 columns. I would suspect that dbaccess has worked
> out the screen is not wide enough to display all the columns in a
> table format hence the second format.
>
> If you want to control the formating, use a reporting tool (4GL, ace)
Yes, I use dbacess
I need this fields in an ASCII file as a table, but I have only
dbaccess.
Do I understand You right, that this realy not possible with dbaccess?
Ralf
Depending on what you want to do - you might find you want to 'unload' the
data instead...
UNLOAD TO 'somefile.unl' SELECT ....
This will generate a file you can use in a shell script for processing anyway
you want.
(Normally - it unloads with a '|' as a delimiter - but you can change this)
On Friday 10 July 2009 15:34:25 Ralf Hackmann wrote:
> On 10 Jul., 15:59, wcottishpoet <drybur...@yahoo.com> wrote:
> > I suspect you are using dbaccess
> >
> > The 1st query only has 5 columns so will easily fit in a tabular form
> >
> > The 2nd query has 7 columns. I would suspect that dbaccess has worked
> > out the screen is not wide enough to display all the columns in a
> > table format hence the second format.
> >
> > If you want to control the formating, use a reporting tool (4GL, ace)
>
> Yes, I use dbacess
>
> I need this fields in an ASCII file as a table, but I have only
> dbaccess.
>
> Do I understand You right, that this realy not possible with dbaccess?
>
> Ralf
> _______________________________________________
> Informix-list mailing list
> Informix-list@iiug.org
> http://www.iiug.org/mailman/listinfo/informix-list
--
Mike Aubury
http://www.aubit.com/
Aubit Computing Ltd is registered in England and Wales, Number: 3112827
Registered Address : Clayton House,59 Piccadilly,Manchester,M1 2AQ
Ralf Hackmann wrote:
> if i run this select statement
>
> select lfdnr, udekz, stuelinr, mengealt, mengeneu from fkstpro>
> I get the result as a table
>
> =>
> lfdnr udekz stuelinr mengealt mengeneu
>
> 1 D 05340205200-0100 1,000 0,000
> 2 E 05340205204-0100 1,000 0,000
> 3 E 05340205200-0100 1,000 0,000
> 4 E 05710222800-0200 1,000 0,000
> 5 E 04910214801-0200 1,000 0,000
> 6 E 04910214801-0200 2,000 0,000
> 7 E 04910214801-0200 2,000 0,000
> ...
>
> but with this statement
>
> select lfdnr, udekz, stuelinr, matalt, mengealt, matneu, mengeneu
> from fkstpro>
> I get this Result
>
>
> lfdnr 1
> udekz D
> stuelinr 05340205200-0100
> matalt 05340205203-0100
> mengealt 1,000
> matneu
> mengeneu 0,000
>
> lfdnr 2
> udekz E
> stuelinr 05340205204-0100
> matalt 05340205203-0100
> mengealt 1,000
> matneu
> mengeneu 0,000
>
> lfdnr 3
> udekz E
> stuelinr 05340205200-0100
> matalt 05340205204-0100
> mengealt 1,000
> matneu
> mengeneu 0,000
> ....
>
> How can I get the result as a table with the second sql statement?
>
If the data fields will fit in 80 columns, use shorter display headings
for those columns where the heading width exceeds the data width.
select ... udekz as u ...
If necessary you could also use an expression to "narrow" the data
select ... trunc(mengealt,0) as ma ...
Just my '0.02 worth
--
RGB