Dear Expertsis any one has a script that makes a page compression for all tables in a databaseI have tried similar to this script but the db still in the same sizeSET NOCOUNT ONSELECT 'ALTER TABLE [' + s.[name] + '].[' + o.[name] + '] REBUILD WITH (DATA_COMPRESSION=PAGE);'FROM sys.objects AS o WITH (NOLOCK)INNER JOIN sys.indexes AS i WITH (NOLOCK) ON o.[object_id] = i.[object_id]INNER JOIN sys.schemas AS s WITH (NOLOCK) ON o.[schema_id] = s.[schema_id]INNER JOIN sys.dm_db_partition_stats AS ps WITH (NOLOCK) ON i.[object_id] = ps.[object_id]AND ps.[index_id] = i.[index_id]WHERE o.[type] = 'U'--AND s.Name LIKE '%%' -- filter by table name--AND o.Name LIKE '%%' -- filter by schema nameORDER BY ps.[reserved_page_count]SET NOCOUNT OFF------------------------------------------------------------------And when I create page compression manually for a certain table the db size is downgradedThank you very much
↧