Now Rebuild Indexes Online In SQL Server 2005!

Today I was looking for a “better way” to rebuild indexes in SQL Server 2005 and to minimize blockingcontention in the database. As I was looking through BOL I came across the ALTER INDEX statement. If you want to rebuild all indexes on a specified table you can run the following code:

ALTER INDEX ALL ON Customer
REBUILD WITH(ONLINE = ON)

If you want to rebuild a specific index on a table you can run the following:

ALTER INDEX idx_customer_name ON Customer
REBUILD WITH(ONLINE = ON)

For more information about the ALTER INDEX statement in SQL Server 2005 visit this site: Alter Index details