update 表名 set bb=cast(bb as varchar(8000))+'rrr'

解决方案 »

  1.   

    --text字段的处理不简单--text字段增加处理--创建测试表
    create table test(id varchar(3),detail text)
    insert into test
    select '001','A*B'--定义添加的的字符串
    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
      

  2.   

    那如果假设bb字段里面的字符已经超过8000个字符
    那cast(bb as varchar(8000))会抱错么?!!!