Microsoft KB Archive/294875

From BetaArchive Wiki
Knowledge Base


FIX: SQLTables() Function Returns No Data for SQL Server Database Names That Contain Underscore

Article ID: 294875

Article Last Modified on 2/23/2007



APPLIES TO

  • Microsoft Data Access Components 2.1
  • Microsoft Data Access Components 2.1 Service Pack 2
  • Microsoft Data Access Components 2.1 Service Pack 1
  • Microsoft Data Access Components 2.1 Service Pack 2
  • Microsoft Data Access Components 2.5
  • Microsoft Data Access Components 2.5 Service Pack 1
  • Microsoft Data Access Components 2.6
  • Microsoft ODBC Driver for Microsoft SQL Server 3.7
  • Microsoft ODBC Driver for Microsoft SQL Server 3.7
  • Microsoft SQL Server 6.5 Enterprise Edition
  • Microsoft SQL Server 7.0 Enterprise Edition
  • Microsoft SQL Server 2000 Enterprise Edition



This article was previously published under Q294875

SYMPTOMS

Calling the ODBC API SQLTables() function on a SQL Server database name that contains an underscore (for example, "my_db") may not return any of the table names contained in the database. When you use MDAC 2.7 SP1, and you call SQLTables with a server-side cursor, you may receive the following error message:

DIAG [24000] [Microsoft][ODBC SQL Server Driver]Invalid cursor state (0)

CAUSE

SQLTables() calls the SQL Server sp_tableswc system stored procedure. This stored procedure returns the table names requested by the function call, but incorrectly filters out database names that contain the underscore. The filter does not return any data for tables of databases with the underscore in the name.

RESOLUTION

To resolve this problem, obtain the latest service pack for Microsoft Data Access Components 2.6. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

300635 INFO: How to Obtain the Latest MDAC 2.6 Service Pack


Hotfix

The English version of this fix should have the following file attributes or later:

   Date      Time     Version     Size    File name     Platform
   -------------------------------------------------------------
   03/27/01  12:22P   8.00.375    733KB   Instcat.sql   all
                


To install Instcat.sql in your SQL Server server, follow these steps:

  1. Back up the server.
  2. Log on to the server as the "SQL Server system administrator (sa)" using Query Analyzer or ISQLW.
  3. On the File menu, click Load to load the Instcat.sql script.
  4. Execute the script.

NOTE: Installing MDAC does not automatically install Instcat.sql on your server. A copy of the Instcat.sql file is found with all versions of MDAC, but you must execute this script file separately as described above to install it in your server. For additional information, see the Readme.txt file that comes with the SQL Server ODBC Driver.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Microsoft Data Access Components 2.6 Service Pack 1.


Additional query words: ODBC SQL Server SQLTables

Keywords: kbbug kbfix kbqfe kbmdac260sp1fix kbdatabase KB294875