SELECT
OBJECT_NAME(i.[object_id])
ObjectName,
s.index_type_desc IndexType,
i.name IndexName,
s.partition_number [Partition#],
ROUND(s.avg_fragmentation_in_percent,
2) [Fragmentation%]
FROM
sys.dm_db_index_physical_stats
(
DB_ID(),
OBJECT_ID('dbo.TABLENAME', 'U'), --<< CHANGE TO
YOUR TABLE
NULL,
NULL,
NULL
) AS s
INNER JOIN sys.indexes AS i ON s.[object_id] = i.[object_id]
WHERE
s.index_id = i.index_id;
No comments:
Post a Comment