Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to find components of composite key

Author  Topic 

IB
Starting Member

4 Posts

Posted - 2007-07-01 : 22:09:17
Hello,

Say I have a composite index, how can I programmatically find the components knowing only the table name?

For example, an index was created as follows:
CREATE UNIQUE INDEX [some_table_index] ON [some_table]([col1], [col2]) ON [PRIMARY]

Now, I'd like to get back 'col1' and 'col2' when I search for 'some_table'.

Thank you

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-07-01 : 23:01:09
Try with 'sp_helpindex tab_mname'.
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-07-02 : 02:33:41
See also INDEX_COL() function in SQL Server help.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -