Microsoft KB Archive/195470

= PRB: ODBC 3.0 Requirements for Numeric Fields =

Article ID: 195470

Article Last Modified on 3/2/2005

-

APPLIES TO


 * Microsoft Data Access Components 2.0
 * Microsoft Data Access Components 2.1
 * Microsoft Data Access Components 2.5
 * Microsoft Data Access Components 2.6
 * Microsoft Data Access Components 2.7
 * Microsoft OLE DB Provider for ODBC 2.0

-



This article was previously published under Q195470



SYMPTOMS
An ODBC Driver, which is written to conform to the ODBC 3.0 Specification, must support the SQL_C_NUMERIC datatype. If the driver returns 3.0 on a call to the SQLGetInfo function (using SQL_DRIVER_ODBC_VER), but does not support the SQL_C_NUMERIC datatype, then a SQL_ERROR may be returned while performing a SQLBindCol or SQLGetData on a decimal field when using the Microsoft Data Access Components (MDAC) 3.0 OLE DB Provider for ODBC.

NOTE: The error message that occurs is driver specific, and some drivers may not return an error message at all.



CAUSE
According to ODBC 3.0 specifications, the SQL C data type, SQL_C_NUMERIC, must be a supported data conversion type for an ODBC 3.0 driver.

The OLE DB Provider for ODBC tests a driver to see if it claims to be compliant with the ODBC 3.0 Specification. If the driver claims to be an ODBC 3.0 driver, and if it supports SQL_API_SQLSETDESCFIELD, then it assumes support for SQL_C_NUMERIC. Hence, when data is prepared for retrieval from a numeric field using SQLBindCol, or retrieved directly using SQLGetData, the Provider uses SQL_C_NUMERIC instead of the default conversion SQL_C_CHAR SQL C datatype. If the ODBC 3.0 driver does not support this data type then a SQL_ERROR may occur, although this depends upon the implementation of the ODBC Driver.



RESOLUTION
The only workaround is that the ODBC 3.0 driver in question needs to support the SQL_C_NUMERIC SQL C datatype. Contact the vendor for your ODBC Driver to inquire about obtaining an ODBC Driver that is compliant with the ODBC 3.0 Specification.

