Share via


ODBC Provider Data Type Conversion

The ODBC Provider supports limited conversions. Only the default types returned in IColumnsInfo are supported, and DBTYPE_BYREF is supported only on variable-length types. Also, some types returned by IColumnsInfo currently cannot be converted to or from DBTYPE_WSTR, which should be valid for all types.

Note

Supported data conversions can be determined through the IConvertType interface.

In the following list, click the data type you want to convert from to view the supported conversions:

I1

R4

DBTIMESTAMP

IUNKNOWN

I2

R8

BOOL

NULL

I4

CY

BSTR

STR

I8

DECIMAL

BYTES

VARIANT

UI1

NUMERIC

Empty

WSTR

UI2

DATE

ERROR

UI4

DBDATE

GUID

UI8

DBTIME

IDISPATCH

Note

When converting DBTYPE_NUMERIC types that correspond to ODBC types SQL_NUMERIC and SQL_DECIMAL, the ODBC Provider exposes additional conversions that are not listed as supported. This occurs because these types are internally bound to SQL_CHAR. Therefore, any conversions supported for CHAR data types in ODBC can be attempted for DBTYPE_NUMERIC types. Some conversions will fail, due to incompatibility, and some will succeed, depending on the data.

This topic is a part of: