存储过程替换text,ntext列中的字符串
日期:2006-03-23 荐:
/*author:amjndate:2003-03-28version:1.0function:替换text,ntext列中的字符串(不支持中文)*/declare @ptr varbinary(16)declare @amjnId intdeclare @Position int,@len intset @len=datalength('ILOVEHJL') declare wux_Cursor scroll Cursorfor select textptr([Name]),[amjnId] from USA201for read onlyopen wux_Cursorfetch next from wux_Cursor into @ptr,@amjnIdwhile @@fetch_status=0begin select @Position=patindex('%ILOVEHJL%',[Name]) from USA201 where [amjnId]=@amjnId while @Position>0 begin set @Position=@Position-1 updatetext USA201.[Name] @ptr @Position @len 'i love hjl' select @Position=patindex('%ILOVEHJL%',[Name]) from USA201 where [amjnId]=@amjnId end fetch next from wux_Cursor into @ptr,@amjnIdendclose wux_cursordeallocate wux_cursorgo
标签: