use 目的库
go
if exists(select name from sysobjects where type='u' id=object_id('表名'))
drop table 表名
go
use 源库
go
select * into 目的库.dbo.表名 from 表名
go
go
if exists(select name from sysobjects where type='u' id=object_id('表名'))
drop table 表名
go
use 源库
go
select * into 目的库.dbo.表名 from 表名
go
go
if exists (select * from dbo.sysobjects where id = object_id(N'tablename') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table tablename
go
select * into tablename from 源库.dbo.tablename
go