I have a SQL Server 2000 database that is approximately 40 GB in size. It's been a while we run optimization plan. Now we want to optimize the database but only on the tables that are badly fragmented. We run Fragmented analysis to find out wich tables are index fragmented. I executed a script to find out all the tables that are fragmented.
I want to rebuild only those indexes that have become badly
fragmented. This will reduce the amount of work to be done, and in turn
reduce the need to grow the database.
How can i do this or how can i write a script that will only rebuild the indexes that have become badly fragmented?