SQL Server TEXT类型字段字符串替换示例处理脚本
来源:互联网 发布:lasercad软件下载 编辑:程序博客网 时间:2024/05/21 11:14
/*--text字段的替换处理
--*/
--创建数据测试环境
--create table #tb(aa text)
declare @s_str varchar(8000),@d_str varchar(8000), --定义替换的字符串
@p varbinary(16),@postion int,@rplen int,@i_Start int, @i_End int
select identity(int,1,1) as [id],newsid into # from news
select @i_Start=min([id]),@i_End=max([id]) from #
while (@i_Start<=@i_End)
begin
--insert into #tb(aa) select content from # where [id]=@i_Start
select @s_str='/' --要替换的字符串
,@d_str='!' --替换成的字符串
--字符串替换处理
select @p=textptr(content),@rplen=len(@s_str),@postion=charindex(@s_str,content)-1 from news where newsid in (select top 1 newsid from # where [id]=@i_Start)
while @postion>0
begin
updatetext news.content @p @postion @rplen @d_str
select @postion=charindex(@s_str,content)-1 from news where newsid in (select top 1 newsid from # where [id]=@i_Start)
end
--truncate table #tb
select @i_Start=@i_Start+1
end
--删除数据测试环境
--drop table #tb
drop table #
- SQL Server TEXT类型字段字符串替换示例处理脚本
- SQL text类型字段字符替换
- MSSQL Server实现text字段类型的字符替换
- SQL Server中TEXT类型字段值在数据库中追加字符串方法
- Sql Server 中 text或ntext 字段内容替换
- SQL替换字段字符串
- 更新SQL Server中的text类型字段值
- SQL Server中的text类型字段要如何查询?
- sql server 替换表中字段字符串子串
- sql text类型内容替换
- sqlserver replace替换text类型字段
- SQL text类型处理
- SQL server替换字符串
- SQL Server 字段类型
- SQL Server 字段类型
- sql server字段类型
- 更新替换sql的text文本字段
- Sql Server 中 text或ntext 字段内容替换方法总结
- 又见CSDN
- 初学者入门篇-----config.bib学习
- VS2005/2008中清除最近打开项目的方法
- 软件架构概念
- Could not load file or assembly 'App_Web_xxxx' or one of its dependencies. The system cannot find the file specified.
- SQL Server TEXT类型字段字符串替换示例处理脚本
- Eclipse 关闭 updating indexes
- 首篇文章欢迎指教 [2008年02月25日]
- 修改XCODE自动生成代码模板
- 测试的价值不仅仅是找Bug
- keil C51初始化代码 Startup.a51的中文说明
- Java 小例子:下载并保存网络小说
- ubuntu /home/dave/.DCOPserver_lappy_0错误
- linux ubuntu上传文件限制