1、创建一个字段名称和数量与存储过程的执行结果一致的临时表;
2、insert into #t1 EXEC Porc1 'a'
示例:
CREATE PROCEDURE Proc1
@a varchar(50)
AS
SELECT Id, NAME FROM Table1 WHERE NAME=@a
GO
CREATE TABLE #t1
(
id int,
NAME varchar(50)
)
go
INSERT INTO #t1 EXEC Proc1 'hovertreename1'
参考: