1.可通过以下格式将结果集插入到临时表,条件:知道返回的结构:
create table #t (
...
)insert into #t exec 存储过程
select * from #t
drop table #t
2.直接select into到临时表: select * into #t from OPENROWSET(
'SQLOLEDB','SERVER=server;uid=sa;pwd=123;Database=testdb',
'SET FMTONLY OFF;set nocount on;exec master..sp_helpserver ''server2''') as a
select * from #t
drop table #t