Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- USE Gastro1 --Enter the name of the database you want to reindex
- DECLARE @TableName varchar(255)
- DECLARE TableCursor CURSOR FOR
- SELECT table_name FROM information_schema.tables
- WHERE table_type = 'base table'
- OPEN TableCursor
- FETCH NEXT FROM TableCursor INTO @TableName
- WHILE @@FETCH_STATUS = 0
- BEGIN
- DBCC DBREINDEX(@TableName,' ',90)
- --SELECT @TableName
- FETCH NEXT FROM TableCursor INTO @TableName
- END
- CLOSE TableCursor
- DEALLOCATE TableCursor
- GO
- EXEC sp_updatestats;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement