A typical Client-Library application retrieves large text or image values by calling ct_get_data inside the fetch loop that’s processing the result set’s rows.
ct_get_data is similar to dbreadtext but is more powerful and flexible.
ct_get_data exhibits the following characteristics:
It retrieves data exactly as it is sent from the server, without performing any conversion.
It can be used to retrieve data from regular and compute columns as well as a stored procedure’s return parameters and return status value. (See “ct_get_data versus dbdata”.)
It can be used to retrieve multiple columns of any datatype. (dbreadtext is restricted to Transact-SQL queries that return exactly one text or image column.)
It is most often used to retrieve large text or image values.
The following restrictions apply to the use of ct_get_data:
When using both ct_bind and ct_get_data to retrieve data in a single result set, the first column retrieved using ct_get_data must follow the last column bound with ct_bind.
For example, if an application selects four columns and binds the first and third columns to program variables, then the application cannot use ct_get_data to retrieve the data contained in the second column. It can still, however, use ct_get_data to retrieve the data in the fourth column.
To work within this restriction, make sure any text or image columns to be retrieved with ct_get_data reside at the end of the select list.
If array binding was indicated in an earlier call to ct_bind, the application cannot use ct_get_data on any column in the result set.