Need a script for Index Defragmentation

  • Hello Folks,

    I am looking a SQL Server 2000 script which does the following:

    1. I want to run DBCC SHOWCONTIG on all the tables in a database

    2. As a parameter I will specify the Scan Density Value...I want to run DBCC INDEXDEFRAG on all the indexes for what Scan Density value is less than that parameter which I have specified.

    Can you guys help me with that. I have tried to make that script but I am not getting it right.

    Thanks in Advance..

    --

    Russell Parker

  • This might be close to what you want.

    Defragment Indexes stored procedure - new version:

    http://weblogs.sqlteam.com/tarad/archive/2007/11/27/60415.aspx

  • Books Online for SQL 2000 has an example script in it under DBCC SHOWCONTIG, but it does an indexdefrag based on a parameter for the logical fragmentation. It should be possible to change it to a parameter on scan density instead

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply