if exists (select * from dbo.sysobjects where id = object_id(n'[dbo].[p_stuff]') and objectproperty(id, n'isprocedure') = 1)drop procedure [dbo].[p_stuff]go
declare tb cursor local for select id,start=datalength(['[email protected]+'])/2from ['[email protected]+']'+case isnull(@where,'') when '' then '' else ' where '[email protected] end+'
open tb fetch tb into @id,@start1while @@fetch_status=0begin select @ptr=textptr(content) from ['[email protected]+'] where [email protected]
if @start is null or @start1<@start updatetext ['[email protected]+'].['[email protected]+'] @ptr null null @str else begin set @[email protected] updatetext ['[email protected]+'].['[email protected]+'] @ptr @start1 @length @str end fetch tb into @id,@start1endclose tbdeallocate tb'exec sp_executesql @s ,n'@start int,@length int,@str nvarchar(4000)' ,@start,@length,@strgo