我试图从另一个sproc中调用一个存储过程,并将结果放入临时表中,而不先创建临时表。有可能做到这一点,还是有更好的办法?我想使用其结果集有多列和多行的sprocB或functionB。谢谢。是否可以调用sproc中的sproc,并将结果放入#temp表中,而无需先创建临时表?
sproc A
..
begin
-- create table #tmp.... -- Try not to create the #tmp table first if possible
exec sproc_B ... put results from sproc_B in #tmp
end
sproc B
..
@id int
..
begin
select table from aTable where id = @id
end
Similiar有人问here。 。
可能重复[如何选择* INTO \ [临时表\] FROM \ [存储过程\]](http://stackoverflow.com/questions/653714/how-to-select-into-temp-表存储过程) – 2012-01-16 15:18:16
是的,这就是我需要的。 thx – RetroCoder 2012-01-16 15:29:17
但另一个问题没有提到从一个sproc调用到另一个sproc。 – RetroCoder 2012-01-16 15:31:41