Binary data consists of hexadecimal numbers. For example, the decimal number 245 is hexadecimal F5. Binary data is stored using the binary, varbinary, and image data types in Microsoft® SQL Server™. A column that is assigned the binary data type must have the same fixed length (up to 8 KB) for each row. In a column that is assigned the varbinary data type, entries can vary in the number of hexadecimal digits (up to 8 KB) they contain. Columns of image data can be used to store variable-length binary data exceeding 8 KB, such as Microsoft Word documents, Microsoft Excel spreadsheets, and images that include bitmaps, GIF (Graphics Interchange Format), and JPEG (Joint Photographic Experts Group) files.
In general, use varbinary for storing binary data, unless the length of the data exceeds 8 KB, in which case you should use image. It is recommended that the defined length of a binary column be no larger than the expected maximum length of the binary data to be stored.
binary and varbinary | Using Data Types |
Using Binary Data | Using Text and Image Data |
image |