How to send parameter inside Job?

  • Hello to all.

    Please, help me. I've a Job than to run to 12 pm everyday, and this JOB to contain 3 SP than depend of two parameter everyone, the IdEmpresa, and IdOficina.

    How i send?

    Thanks to all, and sorry my english isn't good. 😉

    Luis

  • Hi Luis,

    Can I ask how these values are set? Are they outputs of the previous procedure calls within the job.

    Am I right in assuming your job is simply executing the three procedures? i.e

    EXECUTE owner.ProcedureName

    followed by

    EXECUTE owner.ProcedureName2

    and again followed by

    EXECUTE owner.ProcedureName3

  • Of course . my JOB to accept INPUT parameters than soo are INPUT parameters of my tree SP.

    Each SP is executed one after the other.

    What do I do?

    Thanks for helping friend

  • To send, more detail of my SP:

    CREATE proc [dbo].[SP1]

    @IdEmpresa int,

    @IdOficina int,

    AS

    SELECT TABLE1 FROM IdEmp=@IdEmpresa and IdOfi=@IdOficina

    CREATE proc [dbo].[SP2]

    @IdEmpresa int,

    @IdOficina int,

    AS

    SELECT TABLE2 FROM IdEmp=@IdEmpresa and IdOfi=@IdOficina

    CREATE proc [dbo].[SP3]

    @IdEmpresa int,

    @IdOficina int,

    AS

    SELECT TABLE3 FROM IdEmp=@IdEmpresa and IdOfi=@IdOficina

    I want the JOB to run for these three objects.

  • There may be a better way to do this but I would do something like this;

    DECLARE @IdEmpresa INT,

    @IdOficina INT

    SELECT @IdEmpresa = code to set the value,

    @IdOficina = code to set the value

    EXECUTE dbo.SP1 @IdEmpresa,@IdOficina

    EXECUTE dbo.SP2 @IdEmpresa,@IdOficina

    Execute dbo.SP3 @IdEmpresa,@IdOficina

    Hope this helps, as mentioned there maybe a better way to do it (if someone knows then let us know), but the above will work.

  • Thanks friend. i will do 🙂

Viewing 6 posts - 1 through 6 (of 6 total)

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