PRB: SQL Server Cursor Type May Change From Dynamic to KeysetLast reviewed: May 5, 1997Article ID: Q153115 |
The information in this article applies to:
SYMPTOMSUnder certain circumstances, on a table with few rows, a keyset cursor is created on a SELECT statement with an ORDER BY clause even when a dynamic or a server-side forward_only cursor is specified and all the rules for creating dynamic/forward_only cursors are satisfied.
WORKAROUNDSpecify an explicit optimizer hint to use the unique index that you created on the column(s) used in the ORDER BY clause of the SELECT statement. In ISQL/W run the following script: create table test(vendor int not null , upc char(12) not null) go create unique index ind1 on test(upc) go create unique index ind2 on test(vendor) go insert test values(20,'ABC Vision') go insert test values(10,'XYZ Tech') In ODBC Test:
Select * from test (index=ind2) where vendor=20 and upc>='ABC Vision' order by vendorIf you have more than 300 rows in the table, you might not see this problem. It is worth noting that on a small table there is no significant performance difference between a dynamic and a keyset cursor.
|
Additional query words: ODBC RDO VB MFC Database Classes
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |