Data Types for ANSI Compliance - ODBC Driver for Teradata - 16.20

ODBC Driver for Teradata® User Guide

prodname
ODBC Driver for Teradata
vrm_release
16.20
category
User Guide
featnum
B035-2526-108K

The NUMERIC, REAL, and DOUBLE PRECISION data types are actually synonyms for existing Teradata data types: NUMERIC is mapped to DECIMAL, REAL and DOUBLE PRECISION are mapped to FLOAT. As a result, Teradata does not return column type values of NUMERIC, REAL, or DOUBLE PRECISION. Instead, it returns DECIMAL, FLOAT, and FLOAT respectively. SQLGetTypeInfo (SQL_ALL_TYPES) does not return these new ANSI types.

Refer to Teradata Database documentation for a complete description of ANSI features and migration issues.

ODBC Driver for Teradata supports the standard Teradata data types, in addition to the ODBC data types listed in the following table:

ANSI Data Types
TINYINT INTERVAL_YEAR
NUMERIC INTERVAL_MONTH
REAL INTERVAL_DAY
DOUBLE PRECISION INTERVAL_HOUR
BIT INTERVAL_MINUTE
BINARY INTERVAL_SECOND
VARBINARY INTERVAL_HOUR_TO_MINUTE
TIME INTERVAL_DAY_TO_SECOND
TIMESTAMP INTERVAL_HOUR_TO_MINUTE
DATE INTERVAL_HOUR_TO_SECOND
INTERVAL INTERVAL_MINUTE_TO_SECOND

The tables that follow list data type changes occurring between ODBC 2.x and ODBC 3.x. These changes affect the data type names only. Their functionality remains as before.

The following table lists SQL Data Type name changes.

ODBC 2.5 ODBC 3.51
SQL_DATE SQL_TYPE_DATE
SQL_TIME SQL_TYPE_TIME
SQL_TIMESTAMP SQL_TYPE_TIMESTAMP

The following table lists SQL C-Type identifier changes.

ODBC 2.5 ODBC 3.51
SQL_C_DATE SQL_C_TYPE_DATE
SQL_C_TIME SQL_C_TYPE_TIME
SQL_C_TIMESTAMP SQL_C_TYPE_TIMESTAMP
The DATE data types automatically get a default format of YYYY-MM-DD to match the ODBC and ANSI specs. The following table lists columns renamed for ODBC 3.x.

Columns names won't change. The following columns have been renamed for ODBC 3.x. The column name changes do not affect backward compatibility, because applications bind by column number.

ODBC 2.0 column ODBC 3.x column
TABLE_QUALIFIER TABLE_CAT
TABLE_OWNER TABLE_SCHEM
PRECISION COLUMN_SIZE
LENGTH BUFFER_LENGTH
SCALE DECIMAL_DIGITS
RADIX NUM_PREC_RADIX

The following table lists the columns added to the result set returned by SQLColumns in ODBC driver:

Columns Added
CHAR_OCTET_LENGTH ORDINAL_POSITION
COLUMN_DEF SQL_DATA_TYPE
IS_NULLABLE SQL_DATETIME_SUB