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 deterimine if there is a clustered index

Author  Topic 

gregoryagu
Yak Posting Veteran

80 Posts

Posted - 2008-07-24 : 10:37:27
Is there a function which returns whether or not there is a clustered index on a table?

The reason I need this is that I am adding a clustered index via a script, and I want to make sure there is not one already before I add it.

Greg

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-24 : 10:41:21
have a look at sysindexes

select * from sysindexes where indid=1 and OBJECT_NAME(id)='YourTableName'
Go to Top of Page

VGuyz
Posting Yak Master

121 Posts

Posted - 2008-07-24 : 10:49:03
by using the following sp,
you can view the whole stucture of your table

sp_help table_name

or

click your table and press Alt+F1

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-07-24 : 11:38:32
sp_helpindex table_name


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

gregoryagu
Yak Posting Veteran

80 Posts

Posted - 2008-07-24 : 12:11:38
Thanks very much.

Greg
Go to Top of Page
   

- Advertisement -