34,587
社区成员
发帖
与我相关
我的任务
分享
declare @s_str varchar(8000),@d_str varchar(8000)
select @s_str='[PAGE]' --要替换的字符串
,@d_str='[page]***[/page]'--替换成的字符串
--字符串替换处理
declare @p varbinary(16),@postion int,@rplen int
select @p=textptr(memohtml),@rplen=len(@s_str),@postion=charindex(@s_str,memohtml)-1 from [auto_news]
while @postion>0
begin
updatetext [auto_news].[memohtml] @p @postion @rplen @d_str
select @postion=charindex(@s_str,memohtml)-1 from [auto_news]
end
update tb set 字段=cast(replace(cast(字段 as varchar(max)),'[page]','[page]***[/page]') as text)