更新SQL Server中的text类型字段值

来源:互联网 发布:什么数据恢复软件最好 编辑:程序博客网 时间:2024/06/05 06:31

--准备表

create table #tb(aa text)

insert into #tb select 'abcdefghij'
select * from #tb


--得到字段值指针和字段长度

declare @p varbinary(16)
declare @len int
select @p=textptr(aa),@len=DATALENGTH(aa)  from #tb


--定义更新后的新值

declare @str varchar(2000)

set @str='123456'


--更新

updatetext #tb.aa @p 0 @len @str 


select * from #tb
drop table #tb
原创粉丝点击