Posted by pb648174 on 09/30/69 11:45
Ok, does running the below once per week seem reasonable for a SQL 2005
DB?
DECLARE @TableName varchar(255)
DECLARE TableCursor CURSOR FOR
SELECT top 1 table_name FROM information_schema.tables
WHERE table_type = 'base table'
OPEN TableCursor
FETCH NEXT FROM TableCursor INTO @TableName
WHILE @@FETCH_STATUS = 0
BEGIN
Exec('ALTER INDEX ALL ON ' + @TableName + ' REBUILD WITH (FILLFACTOR =
80)')
FETCH NEXT FROM TableCursor INTO @TableName
END
CLOSE TableCursor
DEALLOCATE TableCursor
DBCC CHECKDB
go
Navigation:
[Reply to this message]
|