Not that simple a task since DB2 does not use 'keys' as you would see them defined. Probably your best bet is to use the SYSIBM.SYSKEYS table to look at the column names in the indexes for the table you are selecting for. Then link this back to the SYSCOLUMNS table and then back to your query table.
One gotcha though would be that you do not know that the index has only your key fields - or is an index for searching non-key fields. I am sure there is a way to determine that the index has a unique contraint which should then be the defintion of your keys.... just haven't found it yet.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.