text字段增加处理

来源:互联网 发布:跳跳舞蹈软件下载 编辑:程序博客网 时间:2024/04/30 07:36
--text字段增加处理
 
--创建测试表
create table test(id varchar(3),detail text)
insert into test
select '001','A*B'               select * from test
 
--定义添加的的字符串
declare @s_str varchar(8000),@postion int
select @s_str='*C' --要添加的字符串
,@postion=null--追加的位置,null 加在尾部,0 加在首部,其他值则加在指定位置
 
--字符串添加处理
declare @p varbinary(16)
select @p=textptr(detail) from test where id='001'
updatetext test.detail @p @postion 0 @s_str
 
--显示处理结果
select * from test
go
 
--删除测试表
--drop table test