Monday, March 26, 2012

running a job dyanamically

Hi All,
I have stored procedure which accepts an input
parameter.
I want to execute this stored procedure using a job.
This job will be executed based on an alert. How do I
pass the input parameter dynamically.
I am elaborating by giving an example.
a) procTest accepts a parameter @.n INT
b) There is a job called jobTest which has a step
stpTest which executes procTest @.n
c) If alertA fires I want to execute procTest 1
If alertB fires I want to execute procTest 2
If alertC fires I want to execute procTest 3
I hope I am clear with my question. Is it possible to do
this, or do I need to write seperate jobs for each alert
and hard code the parameter for the stored procedure.
Thanks in advance
AnandGuess the SP could look in sysalerts to see the last one that fired -
but would probably need to hold info for each alert in case multple
alerts fired at the same time (just save the last count for each alert
and check it to see what to process).
A lot easier to just define multiple jobs.
Posted via http://dbforums.com

No comments:

Post a Comment