query to find index on a column

  • Is there a way i can find all the indices on a given column?

  • Sure. The catalog views involved are sys.indexes, sys.index_columns and sys.columns (and maybe sys.tables)

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Hi,

    If u want queried for indexes....

    select name from sysindexes where object_id in (select object_id from systables or syscolumns)

    Go

  • sysindexes and syscolumns are deprecated, should not be used any longer, will be removed from a future version of SQL Server. The replacements are sys.indexes and sys.columns.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply