PRB: Error "Prepared statement is not a cursor-specification" in SQL Server ODBC Driver (244667)
The information in this article applies to:
- Microsoft Data Access Components 2.1 (GA)
- Microsoft Data Access Components 2.1 SP1
- Microsoft Data Access Components 2.1 SP2
- Microsoft ODBC Driver for 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.
RESOLUTIONA 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
STATUSMicrosoft 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.
Modification Type: | Minor | Last Reviewed: | 10/12/2005 |
---|
Keywords: | kbHotfixServer kbQFE kbfix kbMDAC210SP2fix kbMDAC250fix kbMDACNoSweep kbprb kbQFE KB244667 |
---|
|