I have a stored procedure (e.g.
SP_DoSomething) with 2 parameters. Inside the code of this SP there's another SP execution (e.g.
SP_DoSomethingElse) with an enormous list of parameters like this:
CREATE PROCEDURE SP_DoSomethingElse ( @param1 int, ... @paramN int ) AS BEGIN EXEC SP_DoSomethingElse @param1, ... @paramN END
What I want to achieve is to defer the execution of
SP_DoSomethingElse for later execution.
Is there a way to save somewhere (and somehow) the SP execution context (state), including all the parameters and their values?
I prefer not to concatenate as
varchar the whole exec.
I found this similar question but is related to replication:
SP_DoSomething is called and there is already a pending
SP_DoSomethingElse, no special handling is needed because the calls are not related, and they'll just go into a queue.
This is on SQL Server 2014, but with backward compatibility if possible, no matter if not.