You are currently offline, waiting for your internet to reconnect

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

This article has been archived. It is offered "as is" and will no longer be updated.
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)
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.
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 theMicrosoft 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.
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.
ODBC SQL Server SQLTables

Article ID: 294875 - Last Review: 01/11/2015 04:07:59 - Revision: 6.0

Microsoft Data Access Components 2.1, Microsoft Data Access Components 2.5, Microsoft Data Access Components 2.6, Microsoft SQL Server 6.5 Enterprise Edition, Microsoft SQL Server 7.0 Enterprise Edition, Microsoft SQL Server 2000 Enterprise Edition

  • kbnosurvey kbarchive kbbug kbdatabase kbfix kbmdac260sp1fix kbqfe KB294875