Binary data consists of the characters 0 through 9 and A through F (or a through f), in groups of two characters each. Binary strings must be preceded by 0x. For example, to input "FF", type 0xFF. The maximum binary data value is 255 bytes, each of which is "FF". The binary datatypes are not for hexadecimal data, but rather for bit patterns. Conversions and calculations of hexadecimal numbers stored as binary data can be unreliable. For more information, see the CONVERT function in the Functions topic.
When specifying the length of a binary datatype, every two characters count as one. A length of 10 signifies that 10 two-character groupings will be entered.
These are the binary datatypes:
Choose binary when you think the data entries in the column will be consistently close to the same size. Columns of type binary are accessed somewhat faster than varbinary columns because they use a fixed storage length (n).
Note When the binary datatype is used with the ALTER TABLE or CREATE TABLE statement, a column defined as NULL will be handled as a varbinary column.
Choose varbinary when you expect null values or a variation in data size.
Important When n is not specified in a data definition statement (such as CREATE TABLE) or in a variable declaration, the length supplied is 1 (the ANSI-standard). When n is not specified with the CONVERT function, SQL Server defaults to a length of 30.
If the data entered is too long for the specified datatype, binary and varbinary entries are truncated.