Rebuild All Table Indexes in a SQL Server Database with One Command
You can use the sp_MSforeachtable undocumented stored procedure to rebuild all indexes in your database. The command iterates through all the tables in a database. It’s best to schedule this