Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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

View products that this article applies to.

This article was previously published under Q294875

↑ Back to the top


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)

↑ Back to the top


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.

↑ Back to the top


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


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.

↑ Back to the top


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.

↑ Back to the top

Keywords: kbbug, kbdatabase, kbfix, kbmdac260sp1fix, kbqfe, KB294875

↑ Back to the top

Article Info
Article ID : 294875
Revision : 8
Created on : 2/23/2007
Published on : 2/23/2007
Exists online : False
Views : 457