Microsoft KB Archive/167335

From BetaArchive Wiki
Knowledge Base


FIX: Invalid Text Handle Errors May Occur in Transactions

Article ID: 167335

Article Last Modified on 10/3/2003



APPLIES TO

  • Microsoft SQL Server 6.5 Standard Edition



This article was previously published under Q167335

BUG #: 16426

SYMPTOMS

Even if you have the lock isolation level set to HOLDLOCK or REPEATABLE READ, a text pointer can be changed while you are in a transaction. This will result in an invalid text handle when you try to use it again.

For example, during the WAITFOR delay in the following query, another user can update the @mytextptr before you can use it, resulting in an invalid textpointer error:

   BEGIN TRAN
   declare @mytextptr varbinary(16)
   select @mytextptr=TEXTPTR(pr_info)
      from pub_info where pub_id='9999' and
   TEXTVALID('pub_info.pr_info',TEXTPTR(pr_info))=1
   WAITFOR DELAY "00:00:10"
   IF @mytextptr IS NOT NULL
      WRITETEXT  pub_info.pr_info @mytextptr WITH LOG 'Hello Again'
   COMMIT TRAN
                

WORKAROUND

Use the locking hint UPDLOCK, which causes the textpointer to be correctly held. For example:

   select @mytextptr=TEXTPTR(pr_info)
      from pub_info (UPDLOCK) where pub_id='9999' and
   TEXTVALID('pub_info.pr_info',TEXTPTR(pr_info))=1
                

STATUS

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

Keywords: kbbug kbfix kbusage KB167335