How to determine Unique Index column name for a DB2 table?

RDBMS from IBM and IBM's Hierarchical DBMS and Transaction Manager (IMS DC).
Post Reply
Rakhee Aggarwal
New Member
Posts: 7
Joined: Wed Aug 20, 2014 2:02 pm

How to determine Unique Index column name for a DB2 table?

Post 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.
zprogrammer
Global Moderator
Global Moderator
Posts: 588
Joined: Wed Nov 20, 2013 11:53 am
Location: Mars

Re: How to determine Unique Index column name for a DB2 tabl

Post by zprogrammer »

Check this link
zprogrammer
Rakhee Aggarwal
New Member
Posts: 7
Joined: Wed Aug 20, 2014 2:02 pm

Re: How to determine Unique Index column name for a DB2 tabl

Post 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?
Chandan Yadav
Website Team
Website Team
Posts: 70
Joined: Wed Jul 31, 2013 10:19 pm

Re: How to determine Unique Index column name for a DB2 tabl

Post 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
Rakhee Aggarwal
New Member
Posts: 7
Joined: Wed Aug 20, 2014 2:02 pm

Re: How to determine Unique Index column name for a DB2 table?

Post by Rakhee Aggarwal »

Thank you Chandan, this has helped.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM DB2 and IMS DB/DC”