Stored Procedure that will pass multiple parameters to one or many other stored procs

  • Hi. I hope that everyone had a super holiday.

    I have a sql store procedure that has input parameters of a starting and end dates, and 6 other input parameters such as warehouse,territory, distrib#, Pattern, Customer. The starting and end dates are required fields, but the rest of the fields are optional. What I want to do inside this stored procedure is that for example, they input the start and end date and the warehouse, I want to send these three parameters to another stored procedure. What is the easiest way to send these parameters to the 2nd stored procedure and to have it execute from within my calling stored procedure?

    Thanks in advance for you help.

    G

  • The easiest way would be to do as you say, I'm not sure if there's some way around.

    CREATE PROCEDURE CallingProcedure

    (

    @StartDate date,

    @EndDate date,

    @Warehouse int,

    @Territory int,

    @Distrib int,

    @Pattern int,

    @Customer int

    )

    AS

    BEGIN

    --Probably some code

    EXECUTE SomeProcedure @StartDate, @EndDate, @Warehouse

    --Maybe more code

    END

    Or maybe you didn't give enough details of your problem.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Thank you very much, I will give that a try right now. I really appreciate your help and quick response.

    G

Viewing 3 posts - 1 through 2 (of 2 total)

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