Data Types
SQL data types are defined by each DBMS in accordance with the SQL-92
standard. For each SQL data type specified in the SQL-92 standard, ODBC defines a type
identifier, which is a #define value that is passed as an argument in ODBC functions or returned in the
metadata of a result set. The only SQL-92 data types not supported by ODBC are BIT
(the ODBC SQL_BIT type has different characteristics), BIT_VARYING,
TIME_WITH_TIMEZONE, TIMESTAMP_WITH_TIMEZONE, and NATIONAL_CHARACTER. Drivers are
responsible for mapping data source
ODBC defines the C data types and their corresponding ODBC type identifiers.
An application specifies the C data type of the buffer that will receive result
set data by passing the appropriate C type identifier in the TargetType argument in a call to SQLBindCol or SQLGetData. It specifies the C type of the buffer containing a statement parameter by
passing the appropriate C type identifier in the ValueType argument in a call to SQLBindParameter. The C data type is specified in the SQL_DESC_CONCISE_TYPE field of an
application descriptor.
Note There are no driver-specific C data types.
Each SQL data type corresponds to an ODBC C data type. Before returning data
from the data source, the driver converts it to the specified C data type.
Before sending data to the data source, the driver converts it from the specified C
data type.
This appendix discusses the following:
For an explanation of ODBC data types, see
ODBC SQL data types
ODBC C data types
Interval data types
Numeric literals
Data type identifiers, including pseudo type identifiers, transferring data in
its binary form, and information on descriptors
Column size, decimal digits, transfer octet length, and display size of SQL
data types
Converting data from SQL to C data types
Converting data from C to SQL data types