在Text字段尾部追加数据

来源http://blog.csdn.net/zjcxc/archive/2005/05/30/384496.aspx

--示例数据
create table tb(name1 text,name2 varchar(20))
insert tb select 'aa','dd'
union all select 'bb','cc'
go
--处理
declare @p binary(16),@name2 varchar(200)
declare tb cursor local
for
select textptr(name1),name2
from tb

open tb
fetch tb into @p,@name2
while @@fetch_status=0
begin
    UPDATETEXT tb.name1 @p null 0 @name2
    fetch tb into @p,@name2
end
close tb
deallocate tb
select * from tb
GO
--删除测试
drop table tb

/*--结果
name1    name2
------- --------
aadd    dd
bbcc    cc

(所影响的行数为 2 行)
--*/

 

posted @ 2008-12-19 18:03  roboth  阅读(209)  评论(0)    收藏  举报