希望能解决,谢谢
---------------------------------------------------------------
取得存储过程sp2的返回记录,直接select into到临时表:
select * into #t from OPENROWSET(
'SQLOLEDB','SERVER=servername;uid=sa;pwd=123;Database=testdb',
'SET FMTONLY OFF;set nocount on;exec sp2 参数') as a
select * from #t
drop table #t
---------------------------------------------------------------
--或者这样写吧,就不用在调用存储过程中指定库名,当然,连接字符串中就要字符串了
select * into #t
from openrowset('sqloledb','Trusted_Connection=yes;Database=testdb','SET FMTONLY OFF;set nocount on;exec sp2 参数')