Good work Grant. You could probably tune a little bit more for example specifying the page_count limit in the clause and modify the line from
SELECT @command = ''ALTER INDEX '' + @indexname + '' ON ?.'' + @schemaname + ''.'' + @objectname + '' REORGANIZE'';
to
SELECT @command = ''ALTER INDEX ['' + @indexname + ''] ON ?.['' + @schemaname + ''].['' + @objectname + ''] REORGANIZE'';
Same for rebuild..Thanks again - will probably use this at some point
__________________________
Allzu viel ist ungesund...