FIX: Declare Cursor With Comments May Cause Error #707

Last reviewed: May 2, 1997
Article ID: Q149242

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

SYMPTOMS

If a server-side cursor is declared with comments in the select statement, it may cause the following error:

   Msg 707, Level 20, State 2 System error detected during attempt to free
   memory at address 0xddf000. Please consult the SQL Server error log for
   more details. The SQL Server is terminating this process.

It is also possible to cause a thread-level AV.

CAUSE

Limited testing has shown that there is a narrow scope under which this problem is encountered:

  1. Cursor must be deallocated and declared twice in one batch. Breaking it into two separate batches avoids the problem.

  2. Cursor must be deallocated first, declared, opened, fetched, then deallocated again, declared, opened, fetched in the batch. On the second execution of the batch, it would fail on the first deallocate cursor statement. If the cursor is being deallocated at the end of batch, it would not cause the problem.

  3. Cursor must be declared as 'for update.' It does not matter whether it is a scroll cursor or not. It does not matter which fetch mode it is using.

  4. The length of comments is critical here, longer comments may not cause the problem.

WORKAROUND

Do not use comments with the 'declare cursor' statement.

STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.0. This problem has been corrected in U.S. Service Pack 3 for Microsoft SQL Server version 6.0. For more information, contact your primary support provider.


Additional query words: sql6
Keywords : kbbug6.00 kbfix6.00.sp3 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.