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

posted @ 2015-05-07 09:23  caijinhao  阅读(3187)  评论(0编辑  收藏  举报