Use the ODBC function SQLGetTypeInfo 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 ODBC Driver for Teradata and Teradata 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 is 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 is 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) |