Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 SQL Server Job Agent Status in SSIS

Author  Topic 

voyager
Starting Member

2 Posts

Posted - 2008-12-23 : 19:41:49
Hi, can anyone help me with this question: I have created an SSIS project with multiple containers (succession logic: Container 1 > Container 2 > Container 3, etc.) Each of these containers call a SQL Server Job agent, which is configured to call multiple stored procedures.
The problem I'm facing is that the containers (built on 'success' precedence constraint) do not know the status of SQL Server Agent Job. It only knows that the Job has been triggered successfully and it calls the next container (job), even though the 1st job is still running. How can I monitor the job status and ensure it completes before the next container triggers another job ? thanks.

jason7655
Starting Member

24 Posts

Posted - 2008-12-24 : 00:54:48
I'm not sure you can do that.

Could you just call your stored procs from within each container?
Go to Top of Page

rgombina
Constraint Violating Yak Guru

319 Posts

Posted - 2008-12-24 : 11:06:24
Trial and error with this solution... The basic idea is to find out current job status of a specific job name from MSDB. If current job status is 1 (Executing status, sp_help_job) then loop every N minutes (requires For Loop container)

Here's what I came up with which can be tweaked to your requirements:

Items -
1) For Each Loop
2) SQL Task (inside loop)
3) Task to once out of loop

Item #1 (For Loop properties)
EvalExpression = @[User::jobValue]!=4 (4 means Idle job status)
Note: Loop needs to be cycled by time interval say every minute

Item #2 (SQL Task)
Parameter Mapping: jobName (create variable to pass job name eg 'test')
ResultSet: Single row
Parameter Name = current_execution_status (column name from SP output)
Variable Name = User::jobValue (create one to hold current_execution_status value)

Item #3
Execute whatever task from here


SQL TASK Statement:
USE msdb ;
GO

EXEC dbo.sp_help_job
@job_name = N'test'
GO


Hope this gives you a direction to work with...
Go to Top of Page

voyager
Starting Member

2 Posts

Posted - 2008-12-24 : 14:59:41
I was leaning towards the For Loop container, will test this out. Thank you for your inputs.
Go to Top of Page
   

- Advertisement -