Hi All
I'm using the sys.dm_db_index_physical_stats DMV to track Index fragmentation
Why woulf the avg_page_space_used_in_percent column appear as NULL?
This is the code I'm using:
SELECT SO.name,
SI.name IndexName
,SI.type_desc IndexType
,IPS.Avg_Fragmentation_In_Percent
, IPS.index_level
,IPS.avg_page_space_used_in_percent
FROM sys.indexes SI
INNER JOIN sys.objects SO
ON SO.object_id = SI.object_id
INNER JOIN sys.dm_db_index_physical_stats (DB_ID('dbname'), object_id('tablename'), NULL , NULL, N'LIMITED')IPS
ON IPS.OBJECT_ID = SI.object_id
AND IPS.index_id = SI.index_id
where SI.name is not null
Thanks