select * from (存储过程执行并返回的结果表)

select * from (存储过程执行并返回的结果表)

当需要二次查询存储过程执行的结果时就需要利用临时表来解决。

create table #temp(id int,dn nvarchar(20),pt int)
insert into #temp exec FindDepartment @id=1

select * from #temp where id in(select id from #temp)
原文地址:https://www.cnblogs.com/archip/p/2850949.html