34,872
社区成员
发帖
与我相关
我的任务
分享use 旧库
go
exec sp_msforeachtable 'select * into 新库.? from ? where exists(select 1 from tableName where Name=''?'')'--子查询里输入条件判断就行了exec sp_msforeachtable 'select * into web.? from ?'select * into p..t2 from t1 --有结构有数据
select * into p..t2 from t1 where 1=2 --有结构无数据exec sp_msforeachtable 'select * into [web].[dbo].[?] from ?'