Technical Article

Updating all the indexes/statistics of a database

,

The below command will rebuild all indexes on a database.
We need to run the below command in the context of each database that is of interest.

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"

Rate

4 (2)

You rated this post out of 5. Change rating

Share

Share

Rate

4 (2)

You rated this post out of 5. Change rating