I have an existing legacy table that is ~180GB in size due to a client application storing PDF files as varbinary. I'd like to be able to compress that column for all rows using GZIP to help save space while I create a new solution (I was hoping there was a way to do it in SQL and not have to write client code for this). I see that the COMPRESS method is available for Sql Server 2016 but I need a solution that will work with 2008. Any ideas would be appreciated.

  • Although row/page compression is available in SQL 2008 R2, it does not compress LOB types.
    – Dan Guzman
    Jul 14, 2018 at 20:14

1 Answer 1


You can use .NETs GZipStream Class with SQLCLR to do the compression since you are on SQL Server 2008.

Solomon Rutzky has a free SQLCLR version (Util_GZip and Util_GUnzip functions) that you can test and use.

See : Alternative way to compress NVARCHAR(MAX)?

  • 2
    @SolomonRutzky Dude youre the man!
    – Doug Coats
    Nov 15, 2019 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.