binary and varbinary (T-SQL)

Binary data types that are either fixed-length (binary) or variable-length (varbinary).

binary[(n)]
Fixed-length binary data of n bytes. n must be a value from 1 through 8,000. Storage size is n+4 bytes.
varbinary[(n)]
Variable-length binary data of n bytes. n must be a value from 1 through 8,000. Storage size is the actual length of the data entered + 4 bytes, not n bytes. The data entered can be 0 bytes in length. The SQL-92 synonym for varbinary is binary varying.
Remarks

When n is not specified in a data definition or variable declaration statement, the default length is 1. When n is not specified with the CAST function, the default length is 30.

Use binary when the data entries in a column are expected to be consistently close to the same size.

Use varbinary when the data entries in a column are expected to vary considerably in size.

See Also
ALTER TABLE DECLARE @local_variable
CAST and CONVERT DELETE
CREATE TABLE INSERT
Data Type Conversion SET @local_variable
Data Types UPDATE

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.