I would like to run a procedure in MSSQL based on result of some step in other job.
What I want to achieve:
I want to run a specific procedure after LOAD of data. I dont want to set job start time only at specific time but I want to condition run also on success of other step in other job. But I want tu run a job only if some step in other job was successful. And I want to run it at specific time.
The catch is that this procedure is in other JOB. These two procedures are not in the same JOB.
Is it possible to make a condition like this?
Thank you.
Related
I have an SSIS job which pulls data from one database and pushes into another. Currently the actions are triggered when a record is inserted into a table.
My understanding is using a SQL Server trigger to launch an SSIS Job is not advised. Suggesting to me the preferred route for this use case is to use a recurring schedule.
If I schedule every 10 seconds, will the ETL job launch again if the previous run has not finished? (Is there a better word to describe this behavior in the computing spacing?) If the job relaunches, is there a preferred way to accomplish this behavior?
If I schedule every 10 seconds, will the ETL job launch again if the previous run has not finished?
No. The next run time is computed once the job finishes, based on the "Starting at" and the next interval that meets the cycle interval.
While it is running the "Start Job at Step" option on the SQL Server Management Studio interface will be grayed out.
If you try to kick off the job again forcefully using sp_start_job, you'll get a error message saying it's already running.
I would like to run a database procedure after a successful EIM job run to collect information and record historical changes.
How can I call this database procedure automatically without manual intervention.
BR
Hani
Depends on the solution approach you take. If all has to be handeled within Sieber, the a workflow that creates the job, monitors it result and then proceeds with the second step seems to me to be feasible. An alternative would be to use a CI system like Jenkins/Automic to handle the orchestration part.
How do you execute a SQL server agent job in a schedule only if a certain criteria is met.
My example is that I only want to run the job if a boolean value on a different server is set to true otherwise it must not run
Schedules are not conditional. They run at the time they are scheduled, no matter what.
If you want your job to do something only when certain conditions are met, you have to expect that the job will always run on schedule, and put something in the steps that the job executes to check the condition.
So if your job executes SQL Statements, you would put IF blocks in your SQL. If it executes an SSIS package, you would start the package by checking a condition, and so on.
I need to run a task to update a table, periodically, using a stored procedure. Could you let me know if it is possible to schedule periodic tasks and to run any system command within stored procedure?
You can use SQL Server Agent to create jobs that run at regularly-scheduled intervals. One of the job step types is executing a stored procedure.
I use a 3rd party tool for my schedules. To be honest, it's not a great deal better than Sql Server Agent, but there are few perks to it. It's called
System Scheduler.
Here is a picture of how things are supposed to work.
I'll log into sql server and manually start jobA. My interaction ends here. This job doesn't have a schedule enabled. Hence it is manually started. It has 3 steps. The 3rd step will execute another job manually (which is on another server). Technically the 3 step should in turn schedule jobA, to run say after 5 minutes (only 1 time).
But how to schedule jobA which is on another server?
Maybe it is better for jobB to wait for 5 minutes and then start jobA (without scheduling).
Assuming it is SQL Server 2005 or newer, You can use WAITFOR:
WAITFOR DELAY '00:05';
Or if You insist on scheduling a job using stored procedure, check sp_add_schedule stored procedure.
If You already knew this and focus of your question is on 'another' server, check: How to run a Job from a Stored Procedure in another server?