FIX: Transact-SQL READTEXT with INSERT EXEC Generates Error 611

Last reviewed: December 31, 1998
Article ID: Q193991


The information in this article applies to:
  • Microsoft SQL Server version 6.5
BUG #: 16772 (SQLBUG_65)

SYMPTOMS

With SQL Server 6.5, you can create a stored procedure that uses the READTEXT Transact-SQL function to return portions of a text or image column as a result set. The server also allows the Transact-SQL INSERT EXEC functionality to directly insert a result set from a stored procedure into a table.

However, when the stored procedure fails to explicitly call the Transact- SQL return function, error 611 occurs:

   Msg 611, Level 21, State 1
   Attempt made to end a transaction that is idle or in the middle of an
   update.
   The SQL Server is terminating this process.

WORKAROUND

To work around this problem, add an explicit return 0 statement to the end of the stored procedure.

STATUS

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

MORE INFORMATION

The following is a sample Transact-SQL script that uses the READTEXT and INSERT EXEC functionality:

   use pubs
   go

   -----------------
   drop procedure spTest
   go

   -----------------
   create procedure spTest
   as
   declare @txtPtr varbinary(16)

   select @txtPtr = TEXTPTR(pr_info)
   from pub_info
   where pub_id = '0736'


   READTEXT pub_info.pr_info @txtPtr 0 255
   go


   -----------------
   drop table tblTest
   go

   -----------------
   create table tblTest
   (
   tData text
   )
   go

   -----------------
   select * from tblTest
   go

   -----------------
   insert into tblTest
   exec spTest
   go

   -----------------
   select * from tblTest
   go


Additional query words: prodsqlsp sp5tsql t-sql tran-sql trans-sql
Keywords : kbbug6.50 kbfix6.50.sp5
Version : WINNT:6.5
Platform : winnt
Issue type : kbbug


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: December 31, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.