September 7, 2015 at 1:48 am
Hi All,
Following description specifies my requirement. Can you guys go through this and provide me a better solution.
Thanks in advance.
Requirement: Need to pass parameters to a procedure which was called inside a SQL JOB
Description: I have two jobs.
1st JOB: Process my pending queue items and create a list of actions for each queue id with a specific Batch ID.
2nd JOB: Perform the list of actions for each Batch ID by accepting the Batch ID as input.
I need to call the 2nd job inside the first one.
September 7, 2015 at 2:13 am
You can't do it directly, but you could have the first job write the parameter values to a database table, and the second job read from that table.
John
September 7, 2015 at 2:39 am
Hi John,
Thanks for responding. Now I did like that. I created one more procedure which can get the batch id from the physical table then call the second procedure with that ID.
Can you confirm that there is no way to call like that as in my previous post?
September 7, 2015 at 2:45 am
You cannot pass a parameter directly to a job, because jobs are designed to be run automatically on a schedule without user input. You'll have to do some workaround like John suggests.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
September 7, 2015 at 3:49 am
Thanks Shaw.
Is it possible to call a job inside a procedure?
September 7, 2015 at 4:33 am
Sure
EXEC sp_start_job
It takes the job name or ID, server name and step to start the job at as parameters.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply