Tom,
Join systables to sysindexes by tabid and join sysindexes to syscolumns by the absolute value of the "part*" columns to syscolumns.colno. Each contains the colno of one of the key columns in the index in order of appearance. You need to use ABS(part...) because if the column is in the index DESCENDING then its colno will be negated in sysindexes. This will not work for 'special' indexes like functional indexes. There you will have to parse the sysindices table that underlies the sysindexes VIEW (in 9.xx and later sysindexes is not a table but a view into sysindices). You can look at the code for my dbschema and dostats utilities to see how to do this for functional indexes. See the files
dostat.ec or myschema.d/
print_indexes.ec in my package utils2_ak which you can download from the IIUG Software Repository. Feel free to borrow the print_indexes code for you own applications if you are not producing a commercial product for sale (then you'll have to negotiate a license with me - sorry).
Art
--
Art S. Kagel
Oninit (
www.oninit.com)
IIUG Board of Directors (
a...@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.