将存储过程的结果插入临时表 - Insert results of a stored procedure into a temporary table

问题:

How do I do a SELECT * INTO [temp table] FROM [stored procedure] ? 如何SELECT * INTO [temp table] FROM [stored procedure]进行SELECT * INTO [temp table] FROM [stored procedure] Not FROM [Table] and without defining [temp table] ? 不是FROM [Table] ,也没有定义[temp table] ui

Select all data from BusinessLine into tmpBusLine works fine. BusinessLine Select全部数据到tmpBusLine能够正常工做。 spa

select *
into tmpBusLine
from BusinessLine

I am trying the same, but using a stored procedure that returns data, is not quite the same. 我正在尝试相同的方法,可是使用返回数据的stored procedure并不彻底相同。 .net

select *
into tmpBusLine
from
exec getBusinessLineHistory '16 Mar 2009'

Output message: 输出信息: code

Msg 156, Level 15, State 1, Line 2 Incorrect syntax near the keyword 'exec'. 消息156,级别15,状态1,第2行关键字“ exec”附近的语法错误。 get

I have read several examples of creating a temporary table with the same structure as the output stored procedure, which works fine, but it would be nice to not supply any columns. 我已经阅读了几个建立与输出存储过程具备相同结构的临时表的示例,该示例工做正常,可是最好不要提供任何列。 it


解决方案:

参考一: https://stackoom.com/question/2k3m/将存储过程的结果插入临时表
参考二: https://oldbug.net/q/2k3m/Insert-results-of-a-stored-procedure-into-a-temporary-table
相关文章
相关标签/搜索