BINARY and VARBINARY

suggest change

In SQL Server, these are binary data types of either fixed length or variable length.

Syntax:

BINARY [ ( n_bytes ) ]
VARBINARY [ ( n_bytes | max ) ]

n_bytes can be any number from 1 to 8000. max indicates that the maximum storage space is 2^31−1 bytes.

Examples:

SELECT CAST(12345 AS BINARY(10)) -- 0x00000000000000003039
SELECT CAST(12345 AS VARBINARY(10)) -- 0x00003039

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents