-- tables
EXEC sp_MSForEachTable 'ALTER TABLE ? REBUILD PARTITION = ALL WITH (DATA_COMPRESSION = PAGE)'
GO

-- indexes
EXEC sp_MSForEachTable 'ALTER INDEX ALL ON ? REBUILD PARTITION = ALL WITH (DATA_COMPRESSION = PAGE )'
GO

Add comment