日期:2014-05-17 浏览次数:20417 次
update b
set a=a.a,b=a.b,c=a.c
from tb b
inner join ta a on a.id=b.id
--如果批量更新数据,推荐使用MERGE,无论是INSERT还是UPDATE,从执行之间上看,MERGE INTO(MERGE)都要比直接INSERT/UPDATE的效率高;
create table ta(id int,a int,b int,c int)
create table tb(id int,a int,b int,c int)
insert into ta values (1,11,12,13)
insert into ta values (2,21,22,23)
insert into ta values (3,31,32,33)
insert into ta values (4,41,42,43)
insert into ta values (5,51,52,53)
insert into tb values (1,111,12,13)
insert into tb values (2,21,222,23)
insert into tb values (3,31,32,