A google search turns up some scripts that run a query against system tables and iterate over the the results rebuilding (or alternatively, reorganizing) each of your database table indexes in turn. This seems reasonable but the he reason I ask the question here is that taking SQL scripts from an unknown source that query system tables makes me nervous, e.g. maybe it will miss some kinds of index or try and rebuild special system indexes that should be left alone. As it happens the first couple I tried didn't work because they didn't handle tables in different schemas.
So, what is the consensus on the best and simplest way to rebuild all indexes across all tables for an SQL Server 2005 database?
Thankyou.