Rebuild Index Script for SQL Server

DECLARE @tblName VARCHAR(50)

DECLARE rs CURSOR FOR
SELECT TABLE_NAME FROM information_schema.tables WHERE [TABLE_TYPE] =N’BASE TABLE’

OPEN rs
FETCH NEXT FROM rs INTO @tblName

WHILE @@FETCH_STATUS = 0
BEGIN
DBCC DBREINDEX( @tblName,”,90)
END

CLOSE rs
DEALLOCATE rs

, ,

  1. No comments yet.
(will not be published)
Submit Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Subscribe to comments feed
  1. No trackbacks yet.

SetPageWidth