SQL Flow Field Guide

DECOMPRESS

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

system function

What changes

Input
arguments or engine/session state
Output or change
value
Return type
A value of data type varbinary(max). DECOMPRESS uses the Gzip algorithm to decompress the input argument. You should explicitly cast the result to a target type if necessary.

Syntax at a glance

DECOMPRESS ( expression )

Work example

Recover bytes produced by SQL Server COMPRESS.

Read state in the intended scope and immediately after the statement it describes. Treat host values as untrusted.

Check your work Handle invalid payloads and cast the result only after checking its original type contract.

Open Microsoft Learn for full syntax, permissions, and details for your version.