Windows Server 2003 Service Pack 2 has been released. Check this out for details.
UPDATE: This stored procedure has been updated.
This stored procedure defragments indexes in SQL Server 2005. It utilizes sys.dm_db_index_physical_stats, a dynamic management function, to retrieve the fragmentation levels.
If you plan to use DETAILED for @statsMode, you may want to consider running the query that builds the #FragIndex table on a database snapshot. Kalen Delaney mentions this in the May 2006 edition of SQL Server Magazine (InstantDoc ID 49769).
-------------------------------------------------------------------------------------------
-- OBJECT NAME : isp_ALTER_INDEX
--
-- AUTHOR : Tara Kizer
--
-- DATE...
SQL Server 2005 service pack 2 was recently released and already Microsoft has a critical update for it. *Sigh*
Service pack 2 was updated to include this, so you only need to install the critical update if you downloaded service pack 2 prior to March 5, 2007.
Check this out for more details.