June 21, 2010 at 9:07 pm
i want a stored procedure to get the list of indexes for a particular table.
thanku
June 21, 2010 at 9:36 pm
select object_name(i.object_id) as TableName,i.name
from sys.indexes i
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
June 21, 2010 at 9:50 pm
sp_helpindex shows information about indexes
sp_help shows more information about indexes (and lots of other information about a table as well)
June 22, 2010 at 3:12 am
Try this.
select a.name as [Table Name], b.name as [Index Name],
b.type_desc from sys.tables a, sys.indexes b
where a.object_id = b.object_id
and a.name=' Type the table name here'
( Runs on SQL 2005 / 2008).
June 22, 2010 at 12:06 pm
chetanr.jain (6/22/2010)
Try this.select a.name as [Table Name], b.name as [Index Name],
b.type_desc from sys.tables a, sys.indexes b
where a.object_id = b.object_id
and a.name=' Type the table name here'
( Runs on SQL 2005 / 2008).
You can eliminate the join to the sys.tables view altogether by simply retrieving the info directly from sys.indexes. I would also recommend updating the type of join used here and explicitly state the type of join to be used.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply