我試圖從另一個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