如何将存储过程执行后的结果集放入临时表
1个回答
推荐于2017-12-15 · 知道合伙人互联网行家
关注
展开全部
如何将存储过程执行后的结果集放入临时表(MS SQL Server2000)
如果能够得到存储过程结果集的表结构
insert into #tmp exec sp_who
否则
select * into #tmp from OPENROWSET(
'SQLOLEDB',
'SERVER=server;uid=sa;pwd=sapwd;Database=master','exec 存储过程名') as a
如果存储过程中用到临时表,要用set fmtonly off
select * into #tmp from OPENROWSET(
'SQLOLEDB',
'SERVER=server;uid=sa;pwd=sapwd;Database=master','SET FMTONLY OFF; exec 存储过程名') as a
如果能够得到存储过程结果集的表结构
insert into #tmp exec sp_who
否则
select * into #tmp from OPENROWSET(
'SQLOLEDB',
'SERVER=server;uid=sa;pwd=sapwd;Database=master','exec 存储过程名') as a
如果存储过程中用到临时表,要用set fmtonly off
select * into #tmp from OPENROWSET(
'SQLOLEDB',
'SERVER=server;uid=sa;pwd=sapwd;Database=master','SET FMTONLY OFF; exec 存储过程名') as a
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询