T-SQL Tutorial

Varbinary - TSQL Tutorial


On Transact SQL language the binary is part of binary strings data types and have variable length. The string length must be a value from 1 through 8,000.

Varbinary syntax:

varbinary [ ( n ) ]
varbinary [ ( max ) ]

RangeStorage
2^31-1 bytes (2 GB)2 Bytes

Varbinary example:

USE model;
GO
DECLARE @myVar VARBINARY(2);
SET @myVar = 123456789;
SET @myVar = @myVar + 3;
SELECT CAST( @myVar AS INT);
GO

Results
52504