I have 2 stored procedures usp_SP1 and usp_SP2. Both of them use insertion in #tt exec sp_somesp. I wanted to create a third stored procedure that decides which stored proc to call. Sort of:
create proc usp_Decision
(
@value int
)
as
begin
if (@value = 1)
exec usp_SP1
else
exec usp_SP2
end
Later I realized that I needed a specific structure for the return value from usp_Decision so that I could populate the SSRS dataset field. So here is what I tried:
A temporary table was created inside usp_Decision and attempted to "insert in #tt exec usp_SP1". This did not work. "insert exec cannot be nested" error
usp_Decision proc procs "select * from". . , , .
, , .