Number Data Types - ODBC Driver for Teradata

ODBC Driver for Teradata® User Guide

ODBC Driver for Teradata
Release Number
August 2020
English (United States)
Last Update
Product Category
Teradata Tools and Utilities

The Teradata Database Number data types are available in ODBC if supported by the database. A Teradata Database Number type is either Fixed or Floating as listed in the following table.

Number variant Database type Description
Fixed Number NUMBER (p, s) Fixed decimal of p digits with s fractional digits
NUMBER (p) Equivalent to NUMBER(p, 0)
Floating Number NUMBER (*, s) Floating decimal of s fractional digits
NUMBER (*) Floating decimal
NUMBER Equivalent to NUMBER(*)

In ODBC the Number types are treated as standard SQL types. Fixed Number data types are mapped to the standard SQL_DECIMAL data type and Floating Number data types are mapped to SQL_DOUBLE. This means conforming applications do not need to know that the database type corresponding to an SQL_DECIMAL or SQL_DOUBLE is a Number data type.

If an application needs information indicating the database type is a Number type, then the application can examine the Teradata ODBC-specific data type code. This code is returned as a descriptor field in SQLColAttribute and SQLGetDescField. Additionally, the code is returned as a Teradata-specific column in the result set from SQLGetTypeInfo, SQLColumns, and SQLProcedureColumns.

The Teradata ODBC-specific data type codes are as follows:
  • SQL_TD_FIXED_NUMBER for a Fixed Number
  • SQL_TD_FLOATING_NUMBER for a Floating Number
The names SQL_TD_FIXED_NUMBER and SQL_TD_FLOATING_NUMBER are defined in the tdsql.h file. For more information, see Teradata Extensions to the ODBC Standard.