BUG: Syntax Error When Using Qualified Table Name with Quotes

Last reviewed: September 9, 1996
Article ID: Q124319
The information in this article applies to:
  • Microsoft Open Database Connectivity, version 2.0

BUG# QJET: 1800 (2.00.2317)

SYMPTOMS

When using table names qualified with the current qualifier and using identifier quote character to enclose the current qualifier and the table name, you receive a syntax error. This happens with dBASE, Paradox, Microsoft FoxPro, Btrieve, Microsoft Excel, and Text Open Database Connectivity (ODBC) drivers. It does NOT happen with the Microsoft Access driver.

For example, in case of dBase driver, if the values returned by SQLGetConnectOption and SQLGetInfo are as shown:

 SQLGetConnectOption(hdbc,SQL_CURRENT_QUALIFIER,pvParam)
      Returns "C:\Database"
 SQLGetInfo(hdbc, SQL_IDENTIFIER_QUOTE_CHAR, rgbInfoValue,cbInfoValueMax)
      Returns "`"
 SQLGetInfo(hdbc, SQL_QUALIFIER_NAME_SEPARATOR,rgbInfoValue,cbInfoValueMax)
      Returns "\"

Then you let a table called testtable exist in the data source. The queries of the form below will receive syntax error SQLState=37000, szErrorMsg=,

   Syntax error in FROM clause

when executed using SQLExecDirect or SQLExecute calls.

   Select * from 'C:\Database'\'testtable'
   delete from 'C:\Database'\'testtable'
   Update 'C:\Database'\'testtable' set <colname>=<new value>

If you do not use the quote character around the qualifier and the table, these queries work fine.

WORKAROUND

If you do not use the quote character around the qualifier and the table name, the queries work correctly and do not return errors.

Alternately, instead of using the backward slash (\) as a separator, if you use a period (.), which is the separator in the Microsoft Access ODBC driver, the queries work fine with the qualifier and table name enclosed in the quote character.

STATUS

Microsoft has confirmed this to be a problem in ODBC DeskTop Database Drivers Pack version 2.00.2317. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


Additional reference words: 2.00.2317 ODBC MFC Access Windows NT
KBCategory: kbprg
KBSubcategory:



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.

Last reviewed: September 9, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.