Reorganize Indexes

This stored procedure reorganize the indexes for the DB_Name() – DB_ID() 🙂

I don’t remember from where i took some parts for this stored procedure. I’ve modify it according to my need in order to be used. I generally use this SP in a maintenance plan from RBCGxServerGeneral – RBC Etiqette

The procedure can be modified so that should reorganize indexes with an specific maximum fragementation percentage. Now this SP, reorganize indexes who are fragmented with more then 5 %.

The execution of this SP should be as following.

The output message should be something like this.


Enjoy it, and don’t forget to modify it as you need. 🙂


Posted in MSSQL.