EXEC sp_MSforeachtable 'UPDATE STATISTICS ? WITH FULLSCAN' -- {can be run anytime} Exec sp_MSforeachtable "dbcc dbreindex('?')" --- {Always run this on a off-peak hour on any SQL Server instance}Thanks
Karthick
Archive for September, 2010
How to rebuild index and update statistics for all the tables in database.
Posted by Karthick P.K on September 26, 2010
Posted in Optimizer, Performance, SQL General, SQL Query | Tagged: Rebuild indexfor all tables, reindex all tables in database, Script to rebuild index for all tables, SQL General, SQL Query | 3 Comments »