INDEX DEFRAGMENTATION SCRIPT SQL 2000
Index Defragmentation is one of the most important DBA tasks. This will significantly improve query performance. When you perform any DML operation (INSERT, UPDATE, or DELETE statements) table fragmentation can occur. If you use predefined maintenance plan it will take much server resource and time. Here is a custom stored procedure.
Use the DBCC SHOWCONTIG statement. It will display the fragmentation information.
Here I used 3 conditions:
1. Fragmentation >=30 AND PAGES>1000 then rebuild%