FIX: READTEXT May Fail w/ Msg 7134 If Hard Coding Text Pointer

Last reviewed: December 19, 1997
Article ID: Q170507
The information in this article applies to:
  • Microsoft SQL Server, version 6.5 Service Pack 3
BUG #: 17087 (6.5)

SYMPTOMS

The READTEXT statement will fail with "Msg 7134, Level 16, State 2" if both of the following conditions are true:

  • The text pointer provided is hard coded.

    -and-

  • The READTEXT statement is the first statement of the batch.

WORKAROUND

To work around the problem, do either of the following:

  • Use a local variable to store the text pointer, instead of directly hard coding the text pointer value.

    -or-

  • Make sure that the READTEXT statement is not the first statement in the batch. You can consider doing a "dummy" select, such as "select @@version".

STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.5 Service Pack 3. This problem was corrected in the latest Microsoft SQL Server 6.5 U.S. Service Pack. For information on obtaining the service pack, query on the following word in the Microsoft Knowledge Base (without the spaces):

   S E R V P A C K

MORE INFORMATION

The following code segment demonstrates the problem:

   use pubs
   go
   create table test (Tvalue text)
   go
   insert into test values('This is a test')
   go

   select textptr(Tvalue) from test
   go
   -- To demonstrate the problem, the following hard coded text pointer
   -- value should be based on the result of the previous select:

   readtext test.Tvalue 0x510100000000000001000000aa100000 0
   0
   go

   --
   -- The following error message is displayed:
   --    Msg 7134, Level 16, State 2
   --

   --
   -- The following code segment works fine:
   --
   declare @txtptr  varbinary(16)
   select @txtptr=textptr(Tvalue) from test
   readtext test.Tvalue @txtptr 0 0
   go

   --
   -- READTEXT only fails if it is the first statement of the batch.
   -- The following code segment also works:
   --

   select * from titles where title_id = 'PS7777'
   readtext test.Tvalue 0x510100000000000001000000aa100000 0
   0
   go


Additional query words: Transact-SQL T-SQL tsql transql transsql sp sp3
Keywords : kbbug6.50.sp3 SSrvTran_SQL kbfix6.50.sp4 kbusage kbbug6.50.sp3
Version : 6.5
Platform : winnt
Hardware : x86
Issue type : kbbug
Solution Type : kbfix


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