日期:2014-05-18  浏览次数:20499 次

在綫等候sql語句複製數據
我要實現的功能是:
把一個表的數據複製到另外一個表當中
使用sql   :     select   *   into   B     from   A
儅B表不存在的時候可以
但是儅B   已經存在的時候就出錯了
想請問高手除了用DTS外,用sql語句怎麽實現啊?

------解决方案--------------------
insert B select * from A
------解决方案--------------------
if exists(select 1 from sysobjects where name= 'B ')--B表存在时
insert B
select * from A
else B表不存在时
select * into B
from A