Select statement output format.
Posted in 2000
Topics: Installation, Setup & Upgrades, SQL Development & Query Writing, Platform-Specific Issues
Recently I upgraded from 7.2.4 to 9.2.1 on Solaris 2.6. Upon testing some of
my Database access scripts, I noticed that some of the scripts were failing
because the output format had changed for a select statement from column
major to row major format as follows:
7.2.4 OUTPUT:
COL1 COL2
data1.1 data1.2
data2.1 data2.2
Where data1.1 is the data for (row1, column 1) in the desired table, and so
on.
9.2.1 OUTPUT:
COL1 data1.1
COL2 data1.2
COL1 data2.1
COL2 data2.2
A specific query that generates these two different output formats for 7.2.4
versus 9.2.1 using isql is:
select tabname, nrows from systables
After my script executes this query, the script proceeds to parse data
returned by the Informix engine. Therefore the script that was working with
7.2.4 is returning different data when run against 9.2.1 due to the format
change. Is there something I can do (ideally by setting an environment
variable) that would force the 9.2.1 server to revert to the 7.2.4 format
for this output?
Ira Rosen
Motorola, Inc.
It's not a format change as much as it's a column width change. With
9,21 a table name can now be up to 128(?) characters. isql is simply
trying to make sure everything can fit.
You could try using UNLOAD to get a pipe delimited file. Otherwise you
could force the length back to 18 or whatever with:
SELECT tabname[1,24] tabname, nrows FROM systables;
S.W.
swilcoxon@uswest.net
Ira Rosen wrote:
>
> Recently I upgraded from 7.2.4 to 9.2.1 on Solaris 2.6. Upon testing some of
> my Database access scripts, I noticed that some of the scripts were failing
> because the output format had changed for a select statement from column
> major to row major format as follows:
>
> 7.2.4 OUTPUT:
>
> COL1 COL2
> data1.1 data1.2
> data2.1 data2.2
>
> Where data1.1 is the data for (row1, column 1) in the desired table, and so
> on.
>
> 9.2.1 OUTPUT:
>
> COL1 data1.1
> COL2 data1.2
>
> COL1 data2.1
> COL2 data2.2
>
> A specific query that generates these two different output formats for 7.2.4
> versus 9.2.1 using isql is:
> select tabname, nrows from systables>
> After my script executes this query, the script proceeds to parse data
> returned by the Informix engine. Therefore the script that was working with
> 7.2.4 is returning different data when run against 9.2.1 due to the format
> change. Is there something I can do (ideally by setting an environment
> variable) that would force the 9.2.1 server to revert to the 7.2.4 format
> for this output?
>
> Ira Rosen
> Motorola, Inc.