如果新表不存在
select * into newtable from oldtable
如果存在
insert into newtable select * from oldtable ---表結構一致
insert into newtable(列名1,列名2,.....) select 列名1,列名2....from oldtable --表結構不一致
--跨數據庫
--複製結構+數據
select * into 數據庫名.dbo.新表名 from 數據庫名.dbo.原表名
--只複製結構
select * into 數據庫名.dbo.新表名 from 數據庫名.dbo.原表名 where 1=0
--複製到臨時表
select * into #temptablename from 數據庫名.dbo.原表名 where 1=0
--後面的where 1=0 只要不成立就行了,管它是1=2,還是1000=1001...