Sunday, July 27, 2008

SQL Server Central: Updating all the indexes/statistics of a database

Updating all the indexes/statistics of a database - SQL Server Central
sp_MSForEachTable "DBCC DBREINDEX('?')"

The below command is for updating the statistics with full scan.
We also need to run this command in the context of each database.

sp_MSForEachTable  "UPDATE STATISTICS ? with fullscan"

No comments: