Stored Procedures to execute other SPs containing parameters

  • Debbie

    The wrapper proc is the top level stored proc you are talking about. The only thing you need to do is create the top level stored proc and ensure that pass the parameters to the top level proc. Then when you call the other procs, pass those same variables from the top level procedure to them as appropriate.

    Here is some quick code to follow and you can expand

    CREATE usp_TOP_LEVEL_PROC (@ParamForProc1 VARCHAR(50), @ParamForProc2 (VARCHAR(50))

    AS

    BEGIN

    EXEC usp_Proc_1 @ParamforProc1

    EXEC usp_Proc_2 @ParamforProc2

    END

    The conditional code referred to earlier is that you can check results from usp_proc_1 if needed to see if usp_Proc_2 needs to fire.

    Hope this helps

    Marvin Dillard
    Senior Consultant
    Claraview Inc

Viewing post 16 (of 15 total)

You must be logged in to reply to this topic. Login to reply