当前位置: 代码迷 >> Sql Server >> 请教高手一个有关问题 SQL的 ntext字段 怎么进行update 叠加
  详细解决方案

请教高手一个有关问题 SQL的 ntext字段 怎么进行update 叠加

热度:377   发布时间:2016-04-27 19:20:21.0
请问高手一个问题 SQL的 ntext字段 如何进行update 叠加?
请问高手一个问题 SQL的 ntext字段 如何进行update 叠加?
比如 让一个ntext字段的aaa=aaa+"123123" 这个操作如何实现?

如果直接在程序 操作会出现“数据类型问题 ntext类型为add 什么的” 请问该怎么办? 救命!!

------解决方案--------------------
这样可以 吗
SQL code
declare @t table(ID ntext)insert into @t select 'asf'select ID =cast(ID as nvarchar) + cast('123456' as nvarchar) from @t
------解决方案--------------------
SQL code
create table T(Name text)goinsert T select 'aaaa'----2000支持8000个字符,2005用nvarcahr(max)/varchar(max)--与text大小一样update Tset Name=cast(Name as varchar(8000))+'123'from     Tselect * from Taaaa123(所影响的行数为 1 行)
------解决方案--------------------
SQL code
create table T(Name text)goinsert T select 'aaaa'SQL2000text大于8000:declare test cursor forselect textptr(Name)  from T declare @p binary(16)open testfetch next from test into @pwhile @@fetch_status=0begin    updatetext T.Name @p null 0 '1234'    fetch next from test into @pendclose testdeallocate testgoselect * from Taaaa1231234(所影响的行数为 1 行)
  相关解决方案