FIX: Cursor w/ Union May Cause Errors if Not First in Batch

Last reviewed: May 2, 1997
Article ID: Q138746

The information in this article applies to:
  • Microsoft SQL Server, version 6.0
BUG# NT: 11237 (6.00)

SYMPTOMS

If a cursor is opened that contains a union between two queries, you may receive errors such as:

  DB-Library: Possible network error: Bad token from SQL Server:
  Datastream processing out of sync.
  Net-Library error 0:
  DB-Library: Possible network error: Bad token from SQL Server:
  Datastream processing out of sync.  Connection broken.
  <above is repeated many times>
  Net-Library error 6: ConnectionClose (CloseHandle()).
  Msg 533, Level 20, State 4
  Can't find a range table entry for range 5.
  DB-Library Process Dead - Connection Broken

And in some cases, the following message may also occur:

  Msg 16942, Level 16, State 2
  Asyncronous keyset generation failed, the cursor has been deallocated

WORKAROUND

This generally occurs when there are other Transact-SQL statements preceding the declaration of the cursor. Moving the cursor to the beginning of the batch may prevent the errors from occurring.

STATUS

Microsoft has confirmed this to be a problem in SQL Server for Windows NT version 6.0. This problem was corrected in Service Pack 2 for SQL Server version 6.0. For more information, contact your primary support provider.

MORE INFORMATION

Changing the UNION to a UNION ALL can cause the problem seemingly to disappear. However, in some cases, the batch runs without any error in the errorlog or to the client, but the connection is broken and the dbproc is dead.


Additional query words: sql6 cursor union dropped
Keywords : kbbug6.00 kbfix6.00.sp2 kbprg SSrvProg
Version : 6.0
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 2, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.