sql server2000中text类型字符串替换有关问题
sql server2000中text类型字符串替换问题
update t_article set content = replace(convert(varchar(8000),content),'/zc/uploadfiles','/uploadfiles')
在查询分析器中不执行,
错误如下:
服务器: 消息 7102,级别 20,状态 1,行 1
SQL Server 内部错误。文本管理器无法继续执行当前语句。
连接中断
找了一个存储过程:
--定义替换的字符串
declare @s_str varchar(8000),@d_str varchar(8000)
select @s_str='/zc/uploadfiles' --要替换的字符串
,@d_str='/uploadfiles' --替换成的字符串
--字符串替换处理
declare @p varbinary(16),@postion int,@rplen int
select @p=textptr(content),@rplen=len(@s_str),@postion=charindex(@s_str,content)-1 from t_article
while @postion>0
begin
updatetext t_article.content @p @postion @rplen @d_str
select @postion=charindex(@s_str,content)-1 from t_article
end
也不执行,实在没有办法了,请高手帮忙呀。
------解决方案--------------------
select content = replace(convert(varchar(8000),content),'/zc/uploadfiles','/uploadfiles') from t_article 有结果么?
------解决方案--------------------
检查表的数据页是否有错误,
------解决方案--------------------
content 超过 8000 怎么办?
try: UPDATETEXT
------解决方案--------------------
text类型有专门的一套操作函数,不过实在不建议使用text
------解决方案--------------------
text跟普通的操作方法不一样,可以用VARCHAR(MAX)之类的替换。
update t_article set content = replace(convert(varchar(8000),content),'/zc/uploadfiles','/uploadfiles')
在查询分析器中不执行,
错误如下:
服务器: 消息 7102,级别 20,状态 1,行 1
SQL Server 内部错误。文本管理器无法继续执行当前语句。
连接中断
找了一个存储过程:
--定义替换的字符串
declare @s_str varchar(8000),@d_str varchar(8000)
select @s_str='/zc/uploadfiles' --要替换的字符串
,@d_str='/uploadfiles' --替换成的字符串
--字符串替换处理
declare @p varbinary(16),@postion int,@rplen int
select @p=textptr(content),@rplen=len(@s_str),@postion=charindex(@s_str,content)-1 from t_article
while @postion>0
begin
updatetext t_article.content @p @postion @rplen @d_str
select @postion=charindex(@s_str,content)-1 from t_article
end
也不执行,实在没有办法了,请高手帮忙呀。
------解决方案--------------------
select content = replace(convert(varchar(8000),content),'/zc/uploadfiles','/uploadfiles') from t_article 有结果么?
------解决方案--------------------
检查表的数据页是否有错误,
dbcc checktable('t_article')
------解决方案--------------------
content 超过 8000 怎么办?
try: UPDATETEXT
------解决方案--------------------
text类型有专门的一套操作函数,不过实在不建议使用text
------解决方案--------------------
text跟普通的操作方法不一样,可以用VARCHAR(MAX)之类的替换。