日期:2014-05-17 浏览次数:20493 次
update table Name=Name+@Name where ID=@ID
--> 测试数据:[表一]
if object_id('[表一]') is not null drop table [表一]
create table [表一]([xh] int,[zym] varchar(10))
insert [表一]
select 1,'资源1' union all
select 2,'资源2' union all
select 3,'资源3' union all
select 4,'资源4' union all
select 5,'资源5' union all
select 6,'资源6'
declare @name varchar(3)
set @name='zyn'
declare @xh int
set @xh=2
update [表一]
set [zym]=[zym]+@name where [xh]=@xh
select * FROM [表一]
--我的一个例子,没任何问题
/*
xh zym
1 资源1
2 资源2zyn
3 资源3
4 资源4
5 资源5
6 资源6
*/
update t
set name = isNull(name, '') + @Name
where id = @ID