job not running with date parameter

  • I created a job to run these three stored procedures, I'm getting an error when I try to pass in the date parameter. How can I get this to run? The second and third proc need the current date when executed.

    declare @exportdate datetime

    set @exportdate = getdate()

    exec dbo.p_HubToRisk

    exec dbo.p_EventTrackingToStage @exportdate

    exec dbo.p_StageToRisk @exportdate

  • Hi mike,

    what happens if you execute the procedures in Query Analyzer, not as a job - do they accept the date parameter correctly?

    Also, What is the error message in the Agent logs when you execute the job? Please, check both messages: for the job and for the job step by right-clicking the job entry in the Job Monitor under SQL Server Agent and selecting View History. In the History, expand the + sign next to the date/time the job was executed and click first on the Job outcome entry and then on the Step outcome entry. Each time copy the error message below (don't forget to scroll)

    Regards,Yelena Varsha

  • when I run the job in QA it runs successfully although its not adding the date to fields, when I query the table the fields are NULL. I tried to convert the datetime but that didnt work either.

    this didnt work...

    declare @date datetime

    set @date = convert(varchar,getdate(),101)

    exec dbo.p_HubToRisk

    exec dbo.p_EventTrackingToStage @date

    exec dbo.p_StageToRisk @date

  • Mike,

    you have to work with the person who created this procedures or try to read the procedure text to understand that is going on.

    At the very least, post here the top of the procedure text where parameters are defined.

    Regards,Yelena Varsha

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

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