× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hmmm, you're right. It works when reversed. Don't know why I reversed it
when typing it in.

I just looked through our collection of SQL and it looks like every one
with a UNION has string literals for the first few fieldds. That
explains why we always had that issue. Probably never looked past the
first couple to see if we had good names after the bad ones.


Coy Krill
Systems Analyst
Whidbey Island Bank


-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Bruce
Sent: Wednesday, August 30, 2006 09:28
To: java400-l@xxxxxxxxxxxx
Subject: Re: v5r4 SQL Metadata Column names

Correct, in v5r3 flipping the union clause will also return 0001 and 
0002.  But, the original that has the actual columns selected, will 
return the column name even without specifying the name.

We've not being using the field naming on our sql.  Our app relied on 
the column name in the metadata being returned for additional behavior. 
  That's why I'm looking for a one-size-fits all solution so I don't 
have to go back and mod all the sql.

For grins, what if you ran the orig query over your v5r3 machine?  Do 
you get 0001 or QQParm as the col name?

BruceJ

Coy Krill wrote:
We're on V5R3 and we noticed early on that if you didn't have the
fields
named the same then you got the 00001 and 000002 for field names. We
do
the following so that the names are brought back:

select 'Bad' qqparm,'ColNames' qqval from QSYS.QAQQINI 
Union
select qqparm, qqval from QSYS.QAQQINI 

We've been doing this for over a year on V5R3. And I just ran a quick
test and I got the same results as you specify for V5R4. Perhaps you
too
had been naming the fields on your unions? Worth checking.

Coy Krill
Systems Analyst
Whidbey Island Bank


-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Bruce Jones
Sent: Wednesday, August 30, 2006 06:22
To: java400-l@xxxxxxxxxxxx
Subject: v5r4 SQL Metadata Column names

I've noticed a difference with the way column headings are returned in

the metadata when using a UNION in an sql statement.

select qqparm, qqval from QSYS.QAQQINI 
union
select 'Bad','ColNames' from QSYS.QAQQINI 

For v5r4 the column names are 0001 and 0002.
For v5r3 the column names are QQPARM and QQVAL

Anybody else seen this behavior and have a workaround?  Right now, the

solution to add "as qqparm" to the second union (n+) is unacceptable.

Thanks,
Bruce



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.