update table1 set B=Table2.B from table2 where table1.A=table2.Ainsert into table1 
select * from table2 where not exists(select 1 from table1 where A=table2.A)