INF: SQLDescribeCol Limitation on Meta DataLast reviewed: September 9, 1996Article ID: Q101520 |
SUMMARYSQLDescribeCol in the ODBC API and SAG's Call Level Interface Specification is intended to return meta data about a column in a results set. However, it does not return table names as part of this meta data. This article discusses how this limitation stems from SQL92, and also how applications can work around this limitation.
MORE INFORMATIONSQLDescribeCol returns the column names of the results set in szColname. However, when two columns in a results set have the same name (for example, by a join between 2 tables), it does not return the table name along with the column name to differentiate the two similarly named columns. This limitation arises from SQL, more specifically SQL92, which addresses this issue in Subclause 7.4, Syntax Rule 1b) on the 'From Clause': "If the <from clause> contains more than one <table reference> with no intervening <derived table> or <joined table>, then the descriptors of the columns of the result of the <from clause> are the descriptors of the columns of the tables identified by the <table reference>s, in the order in which the <table reference>s appear in the <from clause> and in the order in which the columns are defined within each table." Given the above rule, the following SQL example should clarify this:
// Table1 has a column 'address', and so does Table2select * from Table1, Table2 The 'address' column can be differentiated as being from Table1 or Table2 depending on its position in the results set. The 'address' column from Table1 will always come before the 'address' column in Table2.
|
KBCategory: kbusage
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |