sql-lover (9/28/2012)
...Last but not least, why reinvent the wheel? 🙂 ... unless you are really bored, there are tons of awesome solutions online for Index Maintenance and jobs. My favorite is Ola's solution. Here's the link:
http://ola.hallengren.com/sql-server-index-and-statistics-maintenance.html
It creates smart jobs. So it will skip those Indexes with low page count of low fragmentation. You can also put your own parameters or customize. It keep a history of the job's activity.
Have fun!
+1
Don't reinvent the wheel.
edit:
Also, don't worry about minimum page count or what the optimum magic number for rebuild vs reorg. A good script would have those values config'd out, so the same script can be used in different ways in different circumstances. The flexibility is what makes Ola's script good.