• Getting Sizes for Each Index...

    I borrowed the concept to create a script to get size of each index instead of size of all indexes for the table.

    /* Get tablename, tableid, index name, index id and size in KB(descending) of all indexes for the User tables */

    /* Toni M. */

    select object_name(x.id) 'table name', x.id 'table id',x.name 'index name', x.indid 'index id',

    ((x.used * 8192.00)/1024) IndexSizeKb

    from sysindexes x

    where Substring(x.name,1,7) <> '_WA_SYS' -- do not include statistics

    and x.indid not in (0,255) and -- not a table or TEXT/IMAGE

    exists(Select type from sysobjects o where o.name = object_name(x.id) -- table name for index

    and o.type='U' ) -- user table

    order by IndexSizeKb desc