store producers

  • i want a stored procedure to get the list of indexes for a particular table.

    thanku

  • 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

  • sp_helpindex shows information about indexes

    sp_help shows more information about indexes (and lots of other information about a table as well)

  • 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).

  • 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