• Some changes I would make:

    - get rid of the switch from full or bulk to simple mode or make this an option. This could break log shipping, backup chains, etc. if not careful.

    - If the index is rebuilt, skip the update stats portion. An index rebuild always updates stats with a 100% sampling rate. (See http://www.sqlskills.com/BLOGS/PAUL/post/Search-Engine-QA-10-Rebuilding-Indexes-and-Updating-Statistics.aspx)

    Otherwise, very nice.