HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

GZip existing varbinary(max) column in Sql Server 2008+

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
2008columnvarbinarysqlservermaxexistinggzip

Problem

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.

Solution

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)?

Context

StackExchange Database Administrators Q#212231, answer score: 5

Revisions (0)

No revisions yet.