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.

PRB: Error "Prepared statement is not a cursor-specification" in SQL Server ODBC Driver


View products that this article applies to.

Symptoms

When you use Microsoft SQL Server ODBC driver version 3.70.0623 or 3.70.0690, and call the SQLPrepare function on a statement similar to the following:
   SELECT A.title_id FROM titles A WHERE A.title_id IN (?) GROUP BY A.title_id  
   UNION  
   SELECT B.title_id FROM titles B WHERE B.title_id IN (?) GROUP BY B.title_id
				
and then you call the SQLDescribeCol function, the following error may occur:
[Microsoft][ODBC SQL Server Driver]Prepared statement is not a cursor-specification
The statements execute correctly if the GROUP BY clauses are removed from the SELECT statements. The statements also execute correctly if the GROUP BY clauses remain and you remove the UNION clause, so that each statement is executes separately.

↑ Back to the top


Cause

The problem occurs primarily in statements containing a WHERE clause with a parameter marker, and a UNION clause.

The SQL Server ODBC driver is not correctly parsing the SQL statement, and the Implementation Row Descriptor (IRD) record, which contains information about the columns in the returning result set, is not being set.

Not having a row descriptor, the driver believes the statement is a non-row-returning statement, and returns a message that indicate you are asking for column descriptions on a non-cursor (result set) statement.

↑ 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       Version       Size      File name     
   -------------------------------------------------
   10/22/99   3.70.0741     24.2KB    odbcbcp.dll
   10/22/99   3.70.0741     504KB     sqlsrv32.dll

				



↑ Back to the top


Status

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

This problem has been fixed by Microsoft Data Access Components version 2.5. The problem is also fixed by Microsoft SQL Server version 7.0 Service Pack 2.

↑ Back to the top


More information


Manual Installation



  1. Close or stop any applications or services that are using the Sqlsrv32.dll file. This may include Internet Information Server (IIS), Microsoft Transaction Server (MTS), and any ODBC, ActiveX Data Objects (ADO), or OLE DB applications.
  2. Download the hotfix (UnionParameter.exe) into a temporary directory, and run it to extract the following files:
    Odbcbcp.dll
    Sqlsrv32.dll
  3. Locate and rename the current versions of these files, which should be in the \Winnt\System32 folder for Windows NT computers, and in the \Windows\System folder for Microsoft Windows 95 or Microsoft Windows 98 computers.
  4. Copy the hotfix files into the same location and then restart your services and applications.

↑ Back to the top


Keywords: kbhotfixserver, kbfix, kbmdac210sp2fix, kbmdac250fix, kbmdacnosweep, kbprb, kbqfe, kbqfe, KB244667

↑ Back to the top

Article Info
Article ID : 244667
Revision : 8
Created on : 10/12/2005
Published on : 10/12/2005
Exists online : False
Views : 1196