DOCUMENT:Q101520 30-JUL-2001 [odbc] TITLE :INF: SQLDescribeCol Limitation on Meta Data PRODUCT :Open Database Connectivity (ODBC) PROD/VER: OPER/SYS: KEYWORDS: ====================================================================== SUMMARY ======= SQLDescribeCol 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 INFORMATION ================ SQLDescribeCol 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 contains more than one with no intervening or , then the descriptors of the columns of the result of the are the descriptors of the columns of the tables identified by the
s, in the order in which the
s appear in the 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 Table2 select * 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. Additional query words: 1.00 ====================================================================== Keywords : ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 2001.