Data Types for ODBC

The following table lists the data type support for an ODBC-compliant data source.
For data source specific information about ODBC SQL data types, see the specific ODBC data source documentation.
Data Types for ODBC
Data Type Definition Keyword1
ODBC SQL Identifier
Description
Data Type Returned
BIGINT
SQL_BIGINT
Large signed, exact whole number.
BIGINT
BINARY(n)
SQL_BINARY
Fixed-length binary string.
BINARY(n)
SQL_BIT
Single bit binary data.
CHAR(n)3
SQL_CHAR
Fixed-length character string.
CHAR(n)
DATE
SQL_TYPE_DATE
Date values.
DATE
DECIMAL|NUMERIC(p,s)
SQL_DECIMAL|SQL_NUMERIC
Signed, fixed-point decimal number.
DECIMAL|NUMERIC(p,s)
DOUBLE
SQL_DOUBLE
Signed, double precision, floating-point number.
DOUBLE
FLOAT(p)
SQL_FLOAT
Signed, approximate, floating-point number.
FLOAT(p)
SQL_GUID
Globally unique identifier.
INTEGER
SQL_INTEGER
Regular signed, exact whole number.
INTEGER
SQL_INTERVAL
Intervals between two years, months, days, dates or times.
SQL_LONGVARBINARY
Varying-length binary string.
SQL_LONGVARCHAR
Varying-length Unicode character string.
NCHAR(n)
SQL_WCHAR
Fixed-length Unicode character string.
NCHAR(n)
NVARCHAR(n)
SQL_WVARCHAR
Varying-length Unicode character string.
NVARCHAR(n)
REAL
SQL_REAL
Signed, single precision, floating-point number.
REAL
SMALLINT
SQL_SMALLINT
Small signed, exact whole number.
SMALLINT
TIME(p)
SQL_TYPE_TIME
Time value.
TIME(p)
TIMESTAMP(p)
SQL_TYPE_TIMESTAMP
Date and time value.
TIMESTAMP(p)
TINYINT
SQL_TINYINT
Very small signed, exact whole number.
TINYINT
VARBINARY(n)
SQL_VARBINARY
Varying-length binary string.
VARBINARY(n)
VARCHAR(n)3
SQL_VARCHAR
Varying-length character string.
VARCHAR(n)
SQL_WLONGVARCHAR
Varying-length Unicode character string.
1The CT_PRESERVE= connection argument, which controls how data types are mapped, can affect whether a data type can be defined. The values FORCE (default) and FORCE_COL_SIZE do not affect whether a data type can be defined. The values STRICT and SAFE can result in an error if the requested data type is not native to the data source, or the specified precision or scale is not within the data source range.
2The ODBC SQL data type cannot be defined, and when data is retrieved, the native data type is mapped to a similar data type.
3When you use the CHAR(n) or VARCHAR(n) data type to store multibyte data in a DB2, Greenplum, or Oracle database, you must specify the encoding in the CLIENT_ENCODING= connection option. Or, for Oracle only, to avoid having to set the encoding, use the NCHAR or NVARCHAR data types for multibyte data instead.
Last updated: February 23, 2017