SQL将一个表中的某一列值全部插入到另一个表中

1.  SQL将一个表中的某一列值全部插入到另一个表中

插入的话:
insert into a(col) select col from b;
更新的话:
update a set col=select col from b where a.id=b.id;

判断表是否存在数据库中,存在就删除

if exists (select * from Sysobjects where name='temp')

begin

    drop table temp

end

 

insert into a(columens)
select (columens) from b

原文地址:https://www.cnblogs.com/jinhaoObject/p/4483886.html