I understand that you can set a default fill factor but I want to change existing fill factors back to default across an entire server.
Fill Factor--SQL Server, Is there a way to set Fill Factor across a database, server, or schema?
625 Views Asked by Evan C At
2
There are 2 best solutions below
0
On
BEGIN TRAN
DECLARE @table_name VARCHAR(MAX)
DECLARE table_cursor CURSOR LOCAL
FOR
SELECT
TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
OPEN table_cursor
FETCH NEXT FROM table_cursor INTO @table_name
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT 'ALTER INDEX ALL ON '+@table_name+'
REBUILD WITH (FILLFACTOR = 100)'
END
CLOSE table_cursor;
DEALLOCATE table_cursor;
ROLLBACK TRAN