Programming in MS SQL Server 2012

Binary Data Type



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 SQL Server. A column assigned the binary data type must have the same fixed length (up to 8 KB) for each row. In a column 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, Graphics Interchange Format (GIF), and Joint Photographic Experts Group (JPEG) 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 in SQL Server.

More Reference URL: http://technet.microsoft.com/en-us/library/aa223919%28v=sql.80%29.aspx

* * * * *


Email Your Comment To AUTHOR