Microsoft KB Archive/244667

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

Article ID: 244667

Article Last Modified on 10/12/2005

-

APPLIES TO


 * Microsoft Data Access Components 2.1 Service Pack 2
 * Microsoft Data Access Components 2.1 Service Pack 1
 * Microsoft Data Access Components 2.1 Service Pack 2
 * Microsoft ODBC Driver for Microsoft SQL Server 3.7

-



This article was previously published under Q244667



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.



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.



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



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.



Manual Installation
 

 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. Download the hotfix (UnionParameter.exe) into a temporary directory, and run it to extract the following files:

Odbcbcp.dll

Sqlsrv32.dll

 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. Copy the hotfix files into the same location and then restart your services and applications.</li></ol>

Additional query words: sqlprepare sqldescribecol prepared statement cursor specification odbc sql server driver sqlsrv32.dll union group by

Keywords: kbfix kbmdac250fix kbqfe kbmdac210sp2fix kbprb kbmdacnosweep kbhotfixserver KB244667

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.