Page 1 of 1
How to determine Unique Index column name for a DB2 table?
Posted: Mon Oct 27, 2014 9:13 am
by Rakhee Aggarwal
Hi,
Can you please help me that how to find out the unique index column name for a table? Can we know it from some SYSIBM table? Please guide.
Re: How to determine Unique Index column name for a DB2 tabl
Posted: Mon Oct 27, 2014 8:03 pm
by zprogrammer
Re: How to determine Unique Index column name for a DB2 tabl
Posted: Tue Dec 09, 2014 8:37 pm
by Rakhee Aggarwal
Thanks Pandora-Box. The links gives the details about sysibm.sysindexs but can I write an SQL to retrive the columns for the indexes for a table?
Re: How to determine Unique Index column name for a DB2 tabl
Posted: Wed Dec 10, 2014 8:48 am
by Chandan Yadav
Hi Rakhee,
Please use below query to find unique index of a table
Code: Select all
SELECT NAME,COLNAME
FROM SYSIBM.SYSINDEXES,SYSIBM.SYSKEYS
WHERE TBNAME='table name'
AND TBCREATOR='creator'
AND UNIQUERULE ='U'
AND NAME= IXNAME
AND IXCREATOR=CREATOR
Regards,
Chandan
Re: How to determine Unique Index column name for a DB2 table?
Posted: Fri Nov 20, 2020 11:14 am
by Rakhee Aggarwal
Thank you Chandan, this has helped.