Passing parameter value to SQL job

  • Well, I think this is the problem, no

  • I can think of 2 possible solutions.

    1. Job Is Scheduled and requires user parameters.

    As mentioned earlier use a table to store the parameters that the user enters. These parameters would have to be entered by the user prior to the job executing. In this method, the user would either need an interface (front end), or execute a stored procedure with the parameters to store in this table. When the scheduled job executes, it will "look up" the parameters in the table and execute the sproc. The sproc itself could probably do the lookup of the user parameters.

    2. Do not schedule as a job.

    Create the job without a schedule then use "sp_start_job" to invoke the job. This method requires a user interface (front end) or via T-SQL or stored procedures.

  • Sorry yesterday my post was truncated.

    Well, it seams there is not possible to call, invoke or execute jobs with parameters in non interactive schema.

    My situation is I need to do a reference to one job from several alerts' response option. Well the good news are than when we do that (call job from alerts) we can use tokens (variables) inside of each steps' job, later -in execution time- they will be reemplaced with respectives values. You can see the tokens lists googling sp_addstepjob. This work to me and now I can use just one job unscheduled in many different situation.

Viewing 3 posts - 16 through 17 (of 17 total)

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