In Sql Server 2008, I have a stored proc that writes the result into an output parameter and that inserts the parameters into a table. I want to make the "inserting into a table" part of the SP to run asynchronously so that the result can be read from the output parameter without waiting the insert command complete.
How can I do it?
For example.
CREATE PROCEDURE dbo.Sample_sp
@RESULT INT OUTPUT
@PARAM_1 INT,
@PARAM_2 INT,
@PARAM_N FLOAT
AS
-- Perform Calculations like @RES = @PARAM_1 + @PARAM_2......
INSERT INTO DBO.A VALUES(@PARAM_1, @PARAM_2, ..... @PARAM_N)
EXECUTE ASYNC dbo.Sample_sp