Home > Archive > MS SQL Server > October 2006 > How to find unique indexes in SQLserver 2005









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to find unique indexes in SQLserver 2005
ben brugman

2006-10-24, 6:33 pm

How do I find unique indexes in SQLserver 2005.

Is there a website/page which does describe the information_schema and gives
tips etc.

Now I want to find all unique constraints and unique indexes in a given
database.

Thanks for your time and attention.
ben brugman


Paul Ibison

2006-10-24, 6:33 pm

Ben,
this should do for you:

select * from sys.indexes

where is_unique = 1 or is_unique_constraint
= 1

Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .



Hilary Cotter

2006-10-24, 6:33 pm

select sysobjects.name from sysobjects join
sysindexes on sysobjects.id=sysindexes.id
where sysindexes.status=2 and type='u'


--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.

This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com



"ben brugman" <ben@niethier.nl> wrote in message
news:uhpOyAg5GHA.2208@TK2MSFTNGP04.phx.gbl...
> How do I find unique indexes in SQLserver 2005.
>
> Is there a website/page which does describe the information_schema and
> gives tips etc.
>
> Now I want to find all unique constraints and unique indexes in a given
> database.
>
> Thanks for your time and attention.
> ben brugman
>



Hilary Cotter

2006-10-24, 6:33 pm

Sorry, bad answer. Try this.
--unique indexes
select sysobjects.name,sysindexes.name,sysindexes.status from sysobjects
join
sysindexes on sysobjects.id=sysindexes.id
where (sysindexes.status =2 )
and type='u'
--unique constrains
select name, object_name(parent_o
bject_id) from sys.key_constraints
where type='uq'


--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.

This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com



"Hilary Cotter" <hilary.cotter@gmail.com> wrote in message
news:uMQ8aVg5GHA.1252@TK2MSFTNGP04.phx.gbl...
> select sysobjects.name from sysobjects join
> sysindexes on sysobjects.id=sysindexes.id
> where sysindexes.status=2 and type='u'
>
>
> --
> Hilary Cotter
> Director of Text Mining and Database Strategy
> RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
>
> This posting is my own and doesn't necessarily represent RelevantNoise's
> positions, strategies or opinions.
>
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
>
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
>
>
>
> "ben brugman" <ben@niethier.nl> wrote in message
> news:uhpOyAg5GHA.2208@TK2MSFTNGP04.phx.gbl...
>
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com