22,298
社区成员
发帖
与我相关
我的任务
分享--如果結果集,列數,類型已知
if object_id('tempdb..#')is not null drop table #
go
create table #(ID int ,col1 varchar(10),col2 varchar(10).........)
insert # exec 存儲過程select * into tb2 from tb1 --表tb2不存在
insert into tb2 select * from tb1 --表tb2存在select * into 表 from openrowset( 'SQLOLEDB', 'sql服务器名'; '用户名'; '密码','exec 存儲過程名')