PRB: ATL Consumer Receives DB_S_ERRORSOCCURRED on a Move Operation with SQL Server Text Datatypes (238080)
The information in this article applies to:
- Microsoft ODBC Driver for SQL Server 3.7
This article was previously published under Q238080 SYMPTOMS
When accessing Text data from a SQL Server Table by using Microsoft OLE DB Provider for ODBC Drivers, an ATL Consumer receives the following HRESULT after a Move operation:
HRESULT: 0x00040EDAL ( DB_S_ERRORSOCCURRED )
CAUSE
The SQL Server Text field is a long binary field. The Microsoft SQL Server ODBC driver performs a SQLGetData operation to retrieve long binary or blob data retrieval. The Microsoft SQL Server ODBC driver performs an SQLFetch operation on all the bound columns and then performs the SQLGetData operation on the Text fields. The driver supports retrieving data by using SQLGetData for unbound columns only; that is, the driver returns SQL_GD_BOUND for its SQL_GETDATA_EXTENSIONS attribute. The driver cannot retrieve data from a column if the number of the column specified in the current call is less than the number of the column specified in the preceding call. Therefore, if the Text fields are not the last columns in the table, a call to SQLGetData results in the following error message:
DIAG [S1002] [Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index (0)
As a result, the HRESULT is returned as 0x00040EDAL ( DB_S_ERRORSOCCURRED ).
RESOLUTION
Use one of the following two workarounds:
- Use Microsoft OLEDB Provider for SQL Server instead of the SQL Server ODBC driver through Microsoft OLEDB Provider for ODBC Drivers.
-or-
- Place the Text fields at the end of the SQL query.
STATUS
This behavior is by design.
REFERENCES
Please see the following references for more information:
- Microsoft OLE DB 2.0 Programmer's Reference
- Microsoft Data Access SDK 2.5
Modification Type: | Major | Last Reviewed: | 8/23/2001 |
---|
Keywords: | kbConsumer kbDatabase kbDriver kbprb KB238080 |
---|
|