Dela via


Managing Text and Image Columns

SQL Server text, ntext, and image data (also referred to as long data) are character or binary string data types that can hold data values too large to fit into char, varchar, binary, or varbinary columns. The SQL Server text data type maps to the ODBC SQL_LONGVARCHAR data type; ntext maps to SQL_WLONGVARCHAR; and image maps to SQL_LONGVARBINARY. Some data items, such as long documents or large bitmaps, may be too large to store reasonably in memory. To retrieve long data from SQL Server in sequential parts, the SQL Server Native Client ODBC driver enables an application to call SQLGetData. To send long data in sequential parts, the application can call SQLPutData. Parameters for which data is sent at execution time are known as data-at-execution parameters.

An application can actually write or retrieve any type of data (not just long data) with SQLPutData or SQLGetData, although only character and binary data can be sent or retrieved in parts. However, if the data is small enough to fit in a single buffer, there is generally no reason to use SQLPutData or SQLGetData. It is much easier to bind the single buffer to the parameter or column.