How to Pass Parameter Values in SQL Job Schedule?

  • Please Help me Guys ...

    I am facing the following problem and don't know how to get rid of ... Can AnyOne Help Me ...!

    I have a few Stored Procedures, which update my Database on the Daily Basis, I just had a Problem that I want these Procedures to be run automatically through SQL Job Scheduler. There are two Param which creating me the Problem:

    -- This will Complete a Day's Transactions

    @sDate (Starting Date as 07/15/2009 00:00:00)

    @eDate (Ending Date as 07/15/2009 23:00:00)

    -- I have to pass the Date 1 Day Less from the Current Date, e.g. Today is 15 of July so I have to pass the Date as 14 of July (Requirement of the Scenario)

    I just want to know that how I will be able to pass the Date values to the Param while creating SQL Server Job and it will automatically do the same for the rest of my life

    Execute DisposedMOPrePhase @sDate, @YearMonth

    --Please Help Me ... Thanks in Advance--

  • You could set the param values this way:

    SET @sDate = CONVERT(char(8), GETDATE(), 112)

    SET @eDate = DATEADD(day, 1,DATEADD(second, -1, CONVERT(char(8), GETDATE(), 112)))

    Hope this helps

    Gianluca

    -- Gianluca Sartori

  • It worked ... 😀

    Really Thanx ... Gianluca

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

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