| description | DECOMPRESS (Transact-SQL) | ||
|---|---|---|---|
| title | DECOMPRESS (Transact-SQL) | Microsoft Docs | ||
| ms.custom | |||
| ms.date | 10/11/2018 | ||
| ms.prod | sql | ||
| ms.prod_service | database-engine, sql-database | ||
| ms.reviewer | |||
| ms.technology | t-sql | ||
| ms.topic | reference | ||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| ms.assetid | 738d56be-3870-4774-b112-3dce27becc11 | ||
| author | cawrites | ||
| ms.author | chadam |
[!INCLUDE sqlserver2016-asdb-asdbmi-asa]
This function will decompress an input expression value, using the GZIP algorithm. DECOMPRESS will return a byte array (VARBINARY(MAX) type).
Transact-SQL Syntax Conventions
DECOMPRESS ( expression )
expression
A varbinary(n), varbinary(max), or binary(n) value. See Expressions (Transact-SQL) for more information.
A value of data type varbinary(max). DECOMPRESS will use the ZIP algorithm to decompress the input argument. The user should explicitly cast result to a target type if necessary.
This example shows how to return compressed table data:
SELECT _id, name, surname, datemodified,
CAST(DECOMPRESS(info) AS NVARCHAR(MAX)) AS info
FROM player; This example shows how to create a table for decompressed data storage:
CREATE TABLE example_table (
_id INT PRIMARY KEY IDENTITY,
name NVARCHAR(max),
surname NVARCHAR(max),
info VARBINARY(max),
info_json as CAST(DECOMPRESS(info) as NVARCHAR(max))
);