(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_countFROM
sys.indexes iJOIN
sys.objects oON
i.object_id = o.object_idLEFT
JOIN sys.dm_db_index_usage_stats uON
i.object_id = u.object_idAND
i.index_id = u.index_idAND
u.database_id = DB_ID()JOIN
(SELECT object_id,record_countFROM
master.sys.dm_db_index_physical_stats(DB_ID(), NULL,NULL,NULL,'DETAILED') ) pON
i.object_id = p.object_idWHERE
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