17.20 - SQL_DESC_BASE_COLUMN_NAME When There Is An Alias - ODBC Driver for Teradata

ODBC Driver for Teradata® User Guide

Product
ODBC Driver for Teradata
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2022-06-21
dita:mapPath
uqj1639470627591.ditamap
dita:ditavalPath
nkw1500504256726.ditaval

When extended statement information is not available, the value of the SQL_DESC_BASE_COLUMN_NAME descriptor field will always be the same as the value of the SQL_DESC_NAME descriptor field. The value is the alias, if there is one; otherwise, the column name, if there is one, or the empty string, if there is no alias or column name.

When extended statement information is available, the database returns the alias and base column name as separate meta data items and ODBC Driver for Teradata is, therefore, able to distinguish between SQL_DESC_BASE_COLUMN_NAME and SQL_DESC_NAME. The values will differ if there is an alias.

Consider, for example:

SELECT k AS kalias FROM SomeTable;

With extended statement information available, ODBC Driver for Teradata will return “k” for SQL_DESC_BASE_COLUMN_NAME and “kalias” for SQL_DESC_NAME.