PRB: Select @@Version Not Working on Dynamic Cursors (243382)



The information in this article applies to:

  • Microsoft OLE DB Provider for SQL Server 7.0
  • Microsoft OLE DB Provider for SQL Server 7.01
  • ActiveX Data Objects (ADO) 1.0
  • ActiveX Data Objects (ADO) 2.0
  • ActiveX Data Objects (ADO) 2.1
  • ActiveX Data Objects (ADO) 2.5
  • ActiveX Data Objects (ADO) 2.6

This article was previously published under Q243382

SYMPTOMS

If a SQL Server FAST_FORWARD cursor or any dynamic cursor is specified, a SELECT * FROM ... command runs properly, but a SELECT @@Version (as well as other selects) appears to hang.

CAUSE

This is by design. SQL Server attempts to create a static cursor whenever a select is issued that is not based on table data. If you have specified a dynamic cursor, SQL Server will fail to create the cursor, and return a Low priority message to that effect. OLE DB will repeat the order to create a dynamic cursor, SQL Server will fail again, and this cycle will be repeated until the connection times out.

RESOLUTION

The fix for this problem is to specify a static cursor when doing this type of SELECT. ODBC has internal code to downgrade the cursor if a dynamic cursor is requested and the server can't create it. OLE DB does not.

STATUS

This behavior is by design.

Modification Type:MajorLast Reviewed:10/17/2003
Keywords:kbDatabase kbprb KB243382