Dear Gianluca Sartori,
Thanks for the reply.
The link which you refered to me is very useful and also it's nice script.
When Iam trying to get the avg_fragmentation_in_percent by using the below query it's taking very huge time to provide result.
SELECT OBJECT_NAME(i.OBJECT_ID) AS TableName,
i.name AS IndexName,
indexstats.avg_fragmentation_in_percent
FROM sys.dm_db_index_physical_stats(DB_ID(), NULL, NULL, NULL, 'DETAILED') indexstats
INNER JOIN sys.indexes i ON i.OBJECT_ID = indexstats.OBJECT_ID
AND i.index_id = indexstats.index_id
WHERE indexstats.avg_fragmentation_in_percent > 30
Please advise whether there is any query to get quick output.
Thanks and Regards,
Ravichandra.