Rebuild all index in a database
Several times my colleagues asked me about rebuilding all indices in a database. While there are several solution available, I like to use the one below. Please note that sp_MSforeachtable is undocumented but internal so we can expect a much better performance than our own cursor.
None the less, this has helped me alot, I hope it helps you too!!
USE <DBName>
GO
EXEC sp_MSforeachtable @command1=”print ‘?’ DBCC DBREINDEX (‘?’, ‘ ‘, 80)”
GO
EXEC sp_updatestats
GO
Comments
Excellent blog here! Also your web site loads up very fast!
What web host are you using? Can I get your affiliate
link to your host? I wish my website loaded up as fast as yours lol