KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q315761: FIX: SQLTables() with a Server-Side Cursor Returns No Data

Article: Q315761
Product(s): Open Database Connectivity (ODBC)
Version(s): 1.5,2.0,2.1,2.5,2.6,2.6 SP1,2.6 sp2,2.65,2.65.0212,2.7,2000.80.194,3.0,3.5,3.6,3.7
Operating System(s): 
Keyword(s): kbGrpDSVCDB kbGrpDSMDAC kbMDAC200bug kbMDAC150bug kbMDAC210bug kbMDAC250bug kbMDAC260sp
Last Modified: 08-MAY-2002

-------------------------------------------------------------------------------
The information in this article applies to:

- Microsoft ODBC Driver for SQL Server, versions 2.0, 2.5, 2.65, 2.65.0212, 2000.80.194, 3.0, 3.5, 3.6, 3.7 
- Microsoft Data Access Components versions 1.5, 2.0, 2.1, 2.5, 2.6, 2.6 SP1, 2.6 sp2, 2.7 
-------------------------------------------------------------------------------

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.

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.

RESOLUTION
==========

A supported fix is now available from Microsoft, but it is only intended to
correct the problem described in this article and should be applied only to
systems experiencing this specific problem. This fix may receive additional
testing at a later time, to further ensure product quality. Therefore, if you
are not severely affected by this problem, Microsoft recommends that you wait
for the next Microsoft Data Access Components service pack that contains this
fix.

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, please go to the following
address on the World Wide Web:

  http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

NOTE: In special cases, charges that are normally incurred for support calls may
be canceled, if a Microsoft Support Professional determines that a specific
update will resolve your problem. Normal 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 this to be a bug in the Microsoft products listed at the
beginning of this article.

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.

REFERENCES
==========

For additional information, click the article number below to view the article
in the Microsoft Knowledge Base:

  Q294875 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:

  http://www.microsoft.com/data

Additional query words: instcat underscore _ SQLTables SQLTablesW sp_ddopen sp_tableswc

======================================================================
Keywords          : kbGrpDSVCDB kbGrpDSMDAC kbMDAC200bug kbMDAC150bug kbMDAC210bug kbMDAC250bug kbMDAC260sp1bug 
Technology        : kbSQLServSearch kbAudDeveloper kbODBCSearch kbMDACSearch kbMDAC150 kbMDAC200 kbMDAC210 kbMDAC250 kbMDAC260 kbODBCSQLServ200 kbODBCSQLServ250 kbODBCSQLServ265 kbODBCSQLServ2650212 kbODBCSQLServ200080194 kbODBCSQLServ300 kbODBCSQLServ350 kbODBCSQLServ360 kbODBCSQLServ370 kbMDAC260SP1 kbMDAC270 kbMDAC260SP2
Version           : :1.5,2.0,2.1,2.5,2.6,2.6 SP1,2.6 sp2,2.65,2.65.0212,2.7,2000.80.194,3.0,3.5,3.6,3.7
Issue type        : kbbug
Solution Type     : kbfix

=============================================================================

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.