Where is the 'unique' property and details about the columns covered by an index stored?

Hello All,

How do I find out wether an index is unique in my sql code? Also, how can I get the names of the columns covered by an index (composite or non-composite) in plain text.

I made a fake unique non clustered index on 2 fields and from enterprise manager when I double click on the index it correctly shows that it is unique and the fields it is set on, but I can't find the table this is stored. I tried looking in the INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE table but there is no constraint entry there (isn't unique a constraint ?) Also, the closest thing to finding what columns are covered by the index is the 'keys' column in the sysindexes table but that is saved in a binary format which I don't exactly know how to convert to plain text

I have to go now because all this blue font is making me dizzy

And YES... I am smarter than the average bear


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

YogiMySonMySonAuthor Commented:
basically my aim is to end up with a way of finding columns covered by an index and wether or not it is unique through Transact-SQL

sp_helpidex 'tablename'

return all the information you need?  Of course, since you are smarter than the average bear (lol), you can insert the results of the procedure into a temp table and use it however you need it...


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Anthony PerkinsCommented:

There is a typo there, it should be:
sp_helpindex 'tablename'

Can you remind me the syntax to insert the data from a stored procedure into a temporary table, I cannot seem to figure it out.  I know it is something like:

Select * Into #Temp From exec sp_helpindex 'tablename'

But that is not right.

As Winnie-the-Pooh would say, "I am a bear with a very small brain"
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.


Not that easy, you have to create the table first, then issue the insert.

create table blah (

insert into blah
exec sp_helpindex

Anthony PerkinsCommented:
"I see" said the blind man.

YogiMySonMySonAuthor Commented:
Thanks for the help mate. Sorry I did not reply yesterday, I had to pick someone up.

That's cool.  Wasn't sure if that would do what you needed or not.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.