Microsoft KB Archive/315761

= FIX: SQLTables with a Server-Side Cursor Returns No Data =

Article ID: 315761

Article Last Modified on 10/12/2005

-

APPLIES TO


 * Microsoft ODBC Driver for Microsoft SQL Server 3.7
 * Microsoft ODBC Driver for Microsoft SQL Server 2.0
 * Microsoft ODBC Driver for Microsoft SQL Server 2.5
 * Microsoft ODBC Driver for Microsoft SQL Server 2.65
 * Microsoft ODBC Driver for Microsoft SQL Server 3.7
 * Microsoft ODBC Driver for Microsoft SQL Server 3.7
 * Microsoft ODBC Driver for Microsoft SQL Server 3.0
 * Microsoft ODBC Driver for Microsoft SQL Server 3.5
 * Microsoft ODBC Driver for Microsoft SQL Server 3.6
 * Microsoft Data Access Components 1.5
 * Microsoft Data Access Components 2.0
 * Microsoft Data Access Components 2.1
 * Microsoft Data Access Components 2.5
 * Microsoft Data Access Components 2.6
 * Microsoft Data Access Components 2.6 Service Pack 1
 * Microsoft Data Access Components 2.6 Service Pack 2
 * Microsoft Data Access Components 2.7

-



This article was previously published under Q315761



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:

&quot;[Microsoft][ODBC SQL Server Driver][SQL Server]Unknown sp_ddopen procedure&quot;

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.



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: &quot;Cust_DB&quot; is a sample database name with an underscore.



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:

http://support.microsoft.com/contactus/?ws=support

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



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



Steps to Reproduce Behavior
 Create a database on your SQL Server server with a name that contains an underscore. Create a data source name (DSN) that points to this database. 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. On the Attr menu, click SQLSetStmtAttr to open a server-side cursor on the statement. 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.</li> SQL_SUCCESS_WITH_INFO is returned with the following information:

DIAG [01000] [Microsoft][ODBC SQL Server Driver][SQL Server]Unknown sp_ddopen procedure (0)

</li> On the Results menu, click SQLFetch. No data is returned.</li></ol>

<div class="references_section">