1. If you want a query that returns the column names of a table, or the field names of a file, then you can do the following.
SELECT DISTINCT
SYS_CNAME
FROM
QSYS2.SYSCOLUMNS
WHERE
TABLE_NAME = 'myfile';
The above works for both DB2 for i tables and DB2 for i files.
2. If you want a query that returns data, and you want the system field names as column labels, then one option is to define the labels for each column in the SELECT statement.
Suppose you have a table with three columns in it. Don't use SELECT *. Do something like this instead:
SELECT
MYCOLMA AS MYCOLMA,
MYCOLMB AS MYCOLMB,
MYCOLMC AS MYCOLMC
FROM
MYLIB.MYFILE;
Thanks,
Kelly Cookson
Senior Software Engineer II
Dot Foods, Inc.
217-773-4486 ext. 12676
www.dotfoods.com
As an Amazon Associate we earn from qualifying purchases.
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.