读书人

请教高手一个有关问题 SQL的 ntext字段

发布时间: 2012-03-20 14:01:10 作者: rapoo

请问高手一个问题 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 行) 

读书人网 >SQL Server

热点推荐