FIX: ADO 2.0 Passes Invalid SQL Syntax to Data Source That Does Not Support Schema Separators (293821)



The information in this article applies to:

  • Microsoft Data Access Components 2.0
  • Microsoft Data Access Components 2.1
  • Microsoft Data Access Components 2.1 (GA)
  • Microsoft Data Access Components 2.1 SP1
  • Microsoft Data Access Components 2.1 SP2

This article was previously published under Q293821

SYMPTOMS

If you use ActiveX Data Objects (ADO) 2.0 or 2.1 with an ODBC driver, when you access a database that does not support the schema names, you may receive syntax errors or error 3146 "ODBC Call Failed".

CAUSE

ADO 1.5 submits the following query to the data source for processing:
SELECT * FROM CatalogName.TableName
				
ADO 2.0 and 2.1 include another period before the table name to accommodate the schema name for SQL-92 compliance as follows:
SELECT * FROM CatalogName.SchemaName.TableName
				
However, when no schema name is specified, the following syntax is generated:
SELECT * FROM CatalogName..TableName
				
In ODBC data sources that do not support schema names, this syntax is rejected as invalid, and an error results.

RESOLUTION

To resolve this problem, upgrade to Microsoft Data Access Components (MDAC) version 2.5 or later. You can download the latest version of MDAC from the following Microsoft Web site:

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

This bug was corrected in Microsoft Data Access Components version 2.5 or later (in Msdasql.dll version 2.50.4403.0 or later).

MORE INFORMATION

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

243056 INFO: Using SchemaName and the SchemaSeparator in ODBC


Modification Type:MajorLast Reviewed:12/3/2003
Keywords:kbADO250Fix kbbug kbDatabase kbfix KB293821 kbAudDeveloper