To store binary data of any kind, such as ASCII text, an executable (.exe) file, or a stream of bytes, and with indeterminate length, use the Blob data type. Blob data types are particularly useful for storing Image data from SQL Server.
You can assign values to a Blob field using binary literals. Binary literals begin with a prefix, 0h, followed by a string of hexadecimal numbers and are not enclosed with quotation marks (""), unlike character strings. The following list includes examples of binary literals:
0h (empty binary literal)
Binary literals are limited to 255 encoded bytes.
To store binary values of fixed length, use the Varbinary data type instead. For more information, see Varbinary Data Type.
Support for Blob Data Type
The Blob type is supported for database containers (.dbc), free tables, cursors, and views. For example, you can select this type for a field on the Fields tab in the Table Designer. Tables can contain multiple Blob fields. You can specify default and null values for Blob fields. Blob fields support field validation.
You can view the contents of a field with Blob type using an EditBox control, a TextBox control in a Grid control, or by issuing the MODIFY MEMO command with the name of the Blob field; however, the contents are read-only. The edit box displays Blob type data as hexadecimal values without the 0h prefix. In grids, Blob type fields display the string "blob" if they are empty, and the string "Blob" if they contain data. You can double-click the Blob field in the grid, and an editing window displays the data as read-only.
Index keys based on Blob fields are not supported. No code page translation is performed on data with Blob type.
The following table lists language that contains functionality affected by the Blob data type.
|Values with Blob type are not compatible with the binary expressions produced by the BINTOC(В ) function or used by the CTOBIN(В ) function. String functions that usually return strings, such as the SUBSTR(В ) function, now return binary values when passed binary values.|
For more specifications about the Blob data type, see Visual FoxPro Data and Field Types.