Hi,
we are using sql 2005 and will be migrating to sql 2008 r2 in couple of months.
i am trying to use "sys.dm_db_index_physical_stats" dmv to get fragmentation level of an index but it's getting stuck after certain rows. any suggestions.
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
SELECT ps.database_id, ps.OBJECT_ID,
ps.index_id, b.name,
ps.avg_fragmentation_in_percent
--INTO #temp_Indexes
FROM sys.dm_db_index_physical_stats (7, NULL, NULL, NULL, 'LIMITED') AS ps
INNER JOIN sys.indexes AS b (NOLOCK) ON ps.OBJECT_ID = b.OBJECT_ID
AND ps.index_id = b.index_id
NOw i am using DBCC SHOWCONTIG but this will be deprecated in near future.