Index Key Count

  • I need to find keycnt equivalent in sysindexes table, in the new objects in SQL 2008 like sys.indexes, sys.foreign_keys.

    Thanks

  • Perhaps something like this will work?

    SELECT object_name(i.object_id) as TableName, name as IndexName, KeyCount FROM sys.indexes i inner join

    (select COUNT(*) as KeyCount, object_id, index_id from sys.index_columns where is_included_column = 0 group by object_id, index_id) ic

    on i.object_id=ic.object_id and i.index_id = ic.index_id

    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 2 posts - 1 through 1 (of 1 total)

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