日期:2014-05-18 浏览次数:20400 次
declare @t table(ID ntext) insert into @t select 'asf' select ID =cast(ID as nvarchar) + cast('123456' as nvarchar) from @t
------解决方案--------------------
create table T(Name text) go insert T select 'aaaa' ----2000支持8000个字符,2005用nvarcahr(max)/varchar(max)--与text大小一样 update T set Name=cast(Name as varchar(8000))+'123' from T select * from T aaaa123 (所影响的行数为 1 行)
------解决方案--------------------
create table T(Name text) go insert T select 'aaaa' SQL2000text大于8000: declare test cursor for select textptr(Name) from T declare @p binary(16) open test fetch next from test into @p while @@fetch_status=0 begin updatetext T.Name @p null 0 '1234' fetch next from test into @p end close test deallocate test go select * from T aaaa1231234 (所影响的行数为 1 行)