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.10
Published
October 2021
Language
English (United States)
Last Update
2021-11-02
dita:mapPath
wxs1608578396899.ditamap
dita:ditavalPath
nkw1500504256726.ditaval
dita:id
B035-2526
lifecycle
previous
Product Category
Teradata Tools and Utilities

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.