Share via


Blob Data Type

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:

  • 0h202020

  • 0h6ABCDEF

  • 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.

AFIELDS( ) Function

ALTER TABLE - SQL Command

ALINES( ) Function

BITAND( ) Function

BITCLEAR( ) Function

BITNOT( ) Function

BITOR( ) Function

BITSET( ) Function

BITTEST( ) Function

BITXOR( ) Function

COPY STRUCTURE EXTENDED Command

COPY TO Command

CREATE CURSOR - SQL Command

CREATE FROM Command

CREATE TABLE - SQL Command

CursorSchema Property

CURSORGETPROP( ) Function

CURSORSETPROP( ) Function

CURSORTOXML( ) Function

DataType Property

EMPTY( ) Function

ISBLANK( ) Function

MLINE( ) Function

MODIFY MEMO Command

SET ANSI Command

SET EXACT Command

TRANSFORM( ) Function

XMLTOCURSOR( ) Function

 

 

Note

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.

See Also

Tasks

How to: Choose Data Types

Reference

Fields Tab, Table Designer

DISPLAY STRUCTURE Command

String and Value Comparison in Visual FoxPro

TYPE( ) Function

VARTYPE( ) Function

Other Resources

Data and Field Types