FIX: SQLOLEDB Resends Prepared Commands with Client Cursors

Article translations Article translations
Article ID: 238355 - View products that this article applies to.
This article was previously published under Q238355
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 55798 (SQLBUG_70)
Expand all | Collapse all

SYMPTOMS

When using the SQLOLEDB provider with client side cursors and prepared statements, the performance is slower than with SQL Server 6.5 and ODBC. When tracing the SQL statements sent by the client application with SQL Server Profiler, a sequence of statements similar to the following can be observed:
SQL Server 7.0
sp_prepare @P1 output, N'@P1 varchar(40)', N'select au_fname, au_lname
   from pubs..authors where au_lname like @P1', 1 select @P1
sp_unprepare 1
sp_executesql N'select au_fname,au_lname from pubs..authors
   where au_lname like @P1', N'@P1 nvarchar(2)', N'M%'
					

SQL Server 6.5
create proc #oledbsa1(@P1 varchar(40)) as select au_fname,au_lname<BR/>
   from pubs..authors where au_lname like @P1
select au_fname,au_lname from pubs..authors where au_lname like 'M%'
					

CAUSE

As shown in the SQL trace, under these circumstances the SQLOLEDB provider first prepares the statement but sends it again to get the rows for the client side cursor.

WORKAROUND

To work around this problem, try either of the following:

  • Do not use prepared statements.


    -or-
  • Use server based cursors.

STATUS

Microsoft has confirmed this to be a problem in SQL Server 7.0. This problem has been corrected in U.S. Service Pack 2 for Microsoft SQL Server 7.0. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
254561 INF: How to Obtain Service Pack 2 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0
For more information, contact your primary support provider.

Properties

Article ID: 238355 - Last Review: February 21, 2014 - Revision: 3.1
APPLIES TO
  • Microsoft SQL Server 7.0 Standard Edition
  • Microsoft Data Access Components 2.1
Keywords: 
kbnosurvey kbarchive kbbug kbfix KB238355

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com