0.建表
create table A
(
Id int identity(1,1) not null,
Bid int not null,
Name varchar(20) null
)
insert into A (Bid,Name) values(1,'01')
insert into A (Bid,Name) values(2,'02')
insert into A (Bid,Name) values(3,'03')
create table B
(
Id int identity(1,1) not null,
Name varchar(20) null
)
insert into B(Name) values('good1')
insert into B(Name) values('good2')
insert into B(Name) values('good3')
select * from A
select * from B
1.批量更新操作 :
update A set Name=B.Name from B where A.Bid=B.Id
2.批量插入操作
insert into A
select * from (
select Bid,Name from A
) C