Friday, June 29, 2007

Guest Tips 3: SQL Server reindex

And finally..

Tip #3

This neat litle bit of code rebuilds all indexes on all tables.
sp_MSforeachtable is a System Stored Procedure (as you can see from the sp_ prefix) that performs an action for every user table in the database.

exec sp_MSforeachtable 'dbcc dbreindex (''?'')'

No comments: