How can I use the result set from one stored procedure in another
haider ali
Select an image from your device to upload
Hi Haider, your question is placed in wrong category i think. I take it as SQL question.
-- Your first stored procedure can be a function returning a table
CREATE FUNCTION somefunction
RETURNS TABLE
BEGIN
DECLARE @resultset TABLE
SET @resultset = SELECT * FROM SOMETABLE
return @resultset
END
-- Your second stored procedure
CREATE PROCEDURE someprocedure2
AS
SET @resultset = dbo.somefunction()
-- now use this resultset