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() with a Server-Side Cursor Returns No Data


View products that this article applies to.

This article was previously published under Q315761

↑ Back to the top


Symptoms

When you open a server-side cursor and call the SQLTables or SQLTablesW function against a Microsoft SQL Server database whose name contains an underscore (_), the SQL Server ODBC driver generates SQL_SUCCESS_WITH_INFO with the following message:
"[Microsoft][ODBC SQL Server Driver][SQL Server]Unknown sp_ddopen procedure"
When you call the SQLFetch or SQLExtendedFetch function, no data is returned.

You may see similar behavior when you pass a wildcard character (%) as the database name to obtain the results associated with all databases.

↑ Back to the top


Cause

In the preceding scenario, the following remote procedure call (RPC) is generated by the SQL Server driver:
exec sp_ddopen @P1 output, N'sp_tableswc', @P2 output, @P3 output, @P4 output, NULL, N'%', N'Cust_DB', NULL
				
However, the current system stored procedure sp_ddopen (which is supplied by Instcat.sql or which comes with SQL Server by default) does not account for the sp_tableswc stored procedure.

NOTE: "Cust_DB" is a sample database name with an underscore.

↑ Back to the top


Resolution

A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Microsoft Data Access Components service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the fix. For a complete list of Microsoft Product Support Services phone numbers and information about support costs, visit the following Microsoft Web site:NOTE: In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The typical support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English version of this fix should have the following file attributes or later:
   Date            Size        File name     
   ------------------------------------------------------------
   13-DEC-2001     936,920     Instcat.sql		
				

↑ Back to the top


Status

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

↑ Back to the top


More information

Steps to Reproduce Behavior

  1. Create a database on your SQL Server server with a name that contains an underscore.
  2. Create a data source name (DSN) that points to this database.
  3. Use the ODBCTest tool (ANSI or Unicode version) which ships with the Microsoft Data Access Components (MDAC) software development kit (SDK) and make a full connect to your SQL Server server using the DSN you created in step 2.
  4. On the Attr menu, click SQLSetStmtAttr to open a server-side cursor on the statement.
  5. From the Catalog menu, select SQLTables (or SQLTablesW) and provide the database name with an underscore for the catalog name. You may fill in other parameters, such as schema and table name, if you wish.
  6. SQL_SUCCESS_WITH_INFO is returned with the following information:
    DIAG [01000] [Microsoft][ODBC SQL Server Driver][SQL Server]Unknown sp_ddopen procedure (0)
  7. On the Results menu, click SQLFetch. No data is returned.

↑ Back to the top


References

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
294875� FIX: SQLTables() Function Returns No Data for SQL Server Database Names That Contain Underscore
To obtain the ODBCTest tool that ships with the MDAC SDK, see the following Microsoft Web site:

↑ Back to the top


Keywords: kbhotfixserver, kbqfe, kbbug, kbfix, KB315761

↑ Back to the top

Article Info
Article ID : 315761
Revision : 9
Created on : 10/12/2005
Published on : 10/12/2005
Exists online : False
Views : 634