• (mid-coffee)

    a join seemed to worked, I think...  would it have been better to use APPLY? TIA, I've never tried it.  And thank you for the article!

    >L<

    SELECT

    o.name AS object_name, i.name AS index_name,

    i

    .type_desc, u.user_seeks, u.user_scans, u.user_lookups, u.user_updates,

    p

    .record_count

    FROM

    sys.indexes i

    JOIN

    sys.objects o

    ON

    i.object_id = o.object_id

    LEFT

    JOIN sys.dm_db_index_usage_stats u

    ON

    i.object_id = u.object_id

    AND

    i.index_id = u.index_id

    AND

    u.database_id = DB_ID()

    JOIN

    (SELECT object_id,record_count

    FROM

    master.sys.dm_db_index_physical_stats(DB_ID(), NULL,NULL,NULL,'DETAILED') ) p

    ON

    i.object_id = p.object_id

    WHERE

    o.type <> 'S' -- No system tables!

    ORDER

    BY (ISNULL(p.record_count,0) +ISNULL(u.user_seeks, 0) + ISNULL(u.user_scans, 0) + ISNULL(u.user_lookups, 0) + ISNULL(u.user_updates, 0)), o.name, i.name