SQLGetTypeInfo

ODBC Driver for Teradata® User Guide

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

The ODBC function SQLGetTypeInfo function can be used to enumerate all ODBC SQL types supported by a data source or retrieve information for a single ODBC SQL type. In both cases it returns various information about the ODBC driver and Database specifics for each ODBC SQL type. More than one data type supported by the data source can map to a single ODBC SQL type identifier.

The function returns the results as a standard result set, ordered by DATA_TYPE and then by how closely the data type maps to the corresponding ODBC SQL data type.

To support the JSON data type, the Teradata specific column TDODBC_DATA_TYPE will be set to SQL_TD_JSON or SQL_TD_WJSON depending on the session character set. The JSON data type is only exposed if LOB support is enabled.

The following table shows how JSON will be exposed by SQLGetTypeInfo using a non-Unicode session. Note that the data type is the "key" passed to SQLGetTypeInfo, thus two rows are returned for SQLGetTypeInfo(SQL_LONGVARCHAR).

Type Name Data Type Column Size Create Params TDODBC_DATA_TYPE
CLOB SQL_LONGVARCHAR 2097088000 Max length SQL_LONGVARCHAR
JSON SQL_LONGVARCHAR 16776192 Max length SQL_TD_JSON (18004)

In a Unicode session, the table looks like the following:

Type Name Data Type Column Size Create Params TDODBC_DATA_TYPE
CLOB() CHARACTER SET UNICODE SQL_WLONGVARCHAR 1048544000 Max length SQL_WLONGCHAR
JSON() CHARACTER SET UNICODE SQL_WLONGVARCHAR 8388096 Max length SQL_TD_WJSON (18005)
JSON will be returned as NULLABLE by SQLGetTypeInfo. This is the same as is returned for XML. CLOB and BLOB data types are still returned as non-NULLABLE.