I use this query to analyze index fragmentation. I applied it to and old DB and it returned several tables meeting the criteria but with IndexType = HEAP. As a HEAP has no index what, in this case, is the meaning of index fragmentation returned by the query?
>>>>>>>
SELECT OBJECT_NAME(ind.OBJECT_ID) AS TableName,
ind.name AS IndexName, indexstats.index_type_desc AS IndexType,
indexstats.avg_fragmentation_in_percent
FROM sys.dm_db_index_physical_stats(DB_ID(), NULL, NULL, NULL, NULL) indexstats
INNER JOIN sys.indexes ind
ON ind.object_id = indexstats.object_id
AND ind.index_id = indexstats.index_id
WHERE indexstats.avg_fragmentation_in_percent > 30
ORDER BY indexstats.avg_fragmentation_in_percent DESC
>>>>>>>
TIA,
edm2