Microsoft KB Archive/238355

= FIX: SQLOLEDB Resends Prepared Commands with Client Cursors =

Article ID: 238355

Article Last Modified on 3/14/2006

-

APPLIES TO


 * Microsoft SQL Server 7.0 Standard Edition
 * Microsoft Data Access Components 2.1

-



This article was previously published under Q238355



BUG #: 55798 (SQLBUG_70)



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 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.

Additional query words: OLE DB

Keywords: kbbug kbfix KB238355

-

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

© Microsoft Corporation. All rights reserved.