Hello Friends!

I’m back to you with couple of new functions available in SQL Server 2016 version called “Compress” & “Decompress”. So far most of us are aware about PAGE LEVEL & ROW LEVEL compressions in SQL Server. However I have a had come to a situation, probably once of twice to look for something where data for particular string can be compressed & insert directly to table. Probably that’s the one of strong reason Microsoft has come up with these two new function. Lol! Why would Microsoft gets into my brain to design & deliver an enterprise solution. :)

These two functions use GZip algorithm to compress data in application layer or client side. This compressed data can easily cascade to SQL Server to get stored, or can compress data in SELECT query and DECOMPRESS it in client side. COMPRESS Function returns result as byte array of varchar(max).

Let me jump to explain this quickly with an example. In this example I am going to create simple table with binary data that will contain compressed content.

screen-shot-2016-10-26-at-7-56-37-pm

Happy Learning!

Like us on FaceBook | Join the fastest growing SQL Server group on FaceBook

Follow Avanish Panchal on Twitter | Follow Avanish Panchal on FaceBook