Problem

Apply SQL Server Page and Data Compression (if useful)

Regular Schedule: Every day every 1 hour(s) between 07:00:00 and 18:00:00

Solution: Native T-SQL

Step 1: Collect Page and Data Compression Estimates

https://github.com/steverezhener/DBA/blob/master/Procedures/bestpractices.usp_collect_database_compression_estimate.sql

Step 2: Apply Page/Data Compression based on Estimate

https://github.com/steverezhener/DBA/blob/master/Procedures/bestpractices.usp_apply_database_compression_based_on_estimate.sql

Based on https://learn.microsoft.com/en-us/previous-versions/sql/sql-server-2008/dd894051(v=sql.100)?redirectedfrom=MSDN