我爱Aspx >> 数据库 >> 存储过程替换text,ntext列中的字符串存储过程替换text,ntext列中的字符串
>
/*
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
【我对这篇文章有话说?】
更新sql server的联机丛书[05-22]
1069错误(由于登录失败而无法启..[05-22]
处理孤立用户的存储过程[05-22]
关于MSSQL占用过多内存的问题[05-22]
如何随机选取n条记录或者对记录作..[05-22]
如何将作为字符串保存的IP地址变..[05-22]
如何区分大小写比较[05-22]
如何在视图中使用ORDER BY短语[05-22]
TOP N 和SET ROWCOUNT N 哪个更快[05-22]
关于DTS导入导出丢失默认值等对象[05-22]