存储过程替换text,ntext列中的字符串
时间:2007-01-10 09:58:02
来源: 作者: 点击:次 出处:技术无忧
关键字:存储
/*author:amjn
date:2003-03-28
version:1.0
function:替换text,ntext列中的字符串(不支持中文)
*/
declare @ptr varbinary(16)
declare @amjnId int
declare @Position int,@len int
set @len=datalength('ILOVEHJL')
declare wux_Cursor scroll Cursor
for
select textptr([Name]),[amjnId] from USA201
for read only
open wux_Cursor
fetch next from wux_Cursor into @ptr,@amjnId
while @@fetch_status=0
begin
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,@amjnId
end
close wux_cursor
deallocate wux_cursor
go
本文转自 技术无忧网 网址http://www.pc51.net 访问技术无忧网,软硬件通吃保你技术无忧!











文章评论
共有 0 位网友发表了评论 此处只显示部分留言 点击查看完整评论页面