Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1022085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:24:45+00:00 2026-05-16T11:24:45+00:00

I have a maintenance plan that looks like this… Client 1 Import Data (Success)

  • 0

I have a maintenance plan that looks like this…

Client 1 Import Data (Success) -> Process Data (Success) -> Post Process (Completion) -> Next Client
Client 2 Import Data (Success) -> Process Data (Success) -> Post Process (Completion) -> Next Client
Client N ...

Import Data and Process Data are calling jobs and Post Process is an Execute Sql task.
If Import Data or Process Data Fail, it goes to the next client Import Data…

Both Import Data and Process Data are jobs that contain SSIS packages that are using the built-in SQL logging provider.

My expectation with the configuration as it stands is:

  1. Client 1 Import Data Runs: Failure -> Client 2 Import Data | Success Process Data
  2. Process Data Runs: Failure -> Client 2 Import Data | Success Post Process
  3. Post Process Runs: Completion -> Success or Failure -> Next Client Import Data

This isn’t what I’m seeing in my logs though…
I see several Client Import Data SSIS log entries, then several Post Process log entries, then back to Client Import Data! Arg!!

What am I doing wrong? I didn’t think the “success” piece of Client 1 Import Data would kick off until it… well… succeeded aka finished! The logs seem to indicate otherwise though…

I really need these tasks to be consecutive not concurrent. Is this possible?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T11:24:46+00:00Added an answer on May 16, 2026 at 11:24 am

    For me the workaround ended up being NOT using the built-in “Execute SQL Server Agent Job Task” and instead using “Execute T-SQL Statement Task” and calling a stored procedure that blocked until completion…

    Sweet success 🙂

    CREATE PROCEDURE [dbo].[SQLJob_RunBlocking]
    (
        @JobName SYSNAME
    )
    AS
    BEGIN
        -- running a job returns before the job is complete
        -- this procedure will run the job and loop until its status is complete
        SET NOCOUNT ON;
    
        DECLARE @JobStatus INT;
    
        -- start job
        EXECUTE msdb.dbo.sp_start_job @job_name = @JobName;
    
        -- loop until status is complete
        WHILE ISNULL(@JobStatus, 0) != 4 BEGIN
            WAITFOR DELAY '00:00:01';
    
            EXECUTE dbo.SQLJob_GetStatus @job_name = @JobName, @select_data = 0, @execution_status = @JobStatus OUTPUT;
        END
    END
    

    And…

    CREATE PROCEDURE [dbo].[SQLJob_GetStatus]
    (
        @job_name SYSNAME
        ,@select_data INT = 0
        ,@execution_status INT = NULL OUTPUT
    )
    AS
    BEGIN
        SET NOCOUNT ON;
    
        -- http://www.siccolo.com/Articles/SQLScripts/how-to-create-sql-to-sql-job-execution-status.html
        /*
            Is the execution status for the jobs. 
            Value Description 
            0 Returns only those jobs that are not idle or suspended.  
            1 Executing. 
            2 Waiting for thread. 
            3 Between retries. 
            4 Idle. 
            5 Suspended. 
            7 Performing completion actions 
        */
    
        DECLARE @job_id UNIQUEIDENTIFIER 
            ,@is_sysadmin INT
            ,@job_owner SYSNAME;
    
        SELECT @job_id = job_id FROM msdb.dbo.sysjobs_view where name = @job_name;
        SELECT @is_sysadmin = ISNULL(IS_SRVROLEMEMBER(N'sysadmin'), 0);
        SELECT @job_owner = SUSER_SNAME();
    
        CREATE TABLE #xp_results (
            job_id                UNIQUEIDENTIFIER NOT NULL,
            last_run_date         INT              NOT NULL,
            last_run_time         INT              NOT NULL,
            next_run_date         INT              NOT NULL,
            next_run_time         INT              NOT NULL,
            next_run_schedule_id  INT              NOT NULL,
            requested_to_run      INT              NOT NULL, -- BOOL
            request_source        INT              NOT NULL,
            request_source_id     sysname          COLLATE database_default NULL,
            running               INT              NOT NULL, -- BOOL
            current_step          INT              NOT NULL,
            current_retry_attempt INT              NOT NULL,
            job_state             INT              NOT NULL
        );
    
    
        IF ((@@microsoftversion / 0x01000000) >= 8) -- SQL Server 8.0 or greater
            INSERT INTO #xp_results
            EXECUTE master.dbo.xp_sqlagent_enum_jobs @is_sysadmin, @job_owner, @job_id;
        ELSE
            INSERT INTO #xp_results
            EXECUTE master.dbo.xp_sqlagent_enum_jobs @is_sysadmin, @job_owner;
    
        --declare @execution_status int
        SET @execution_status = (SELECT job_state FROM #xp_results);
    
        DROP TABLE #xp_results;
    
        IF @select_data = 1 
            SELECT @job_name AS 'job_name', @execution_status AS 'execution_status';
    END
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query that looks something like this: select xmlelement(rootNode, (case when XH.ID
We have a daily maintenance plan in SQL Server 2005 that performs a full
I have a maintenance application that has to turn enterprise data (from various databases/tables)
I have a SQL Server 2005 .BAK file (created with a maintenance plan) that
I was going to ask this in tigris.org, however they have maintenance in their
I have a php that makes some maintenance operations in my web and I
I have kept hearing this statement. Switch..Case is Evil for code maintenance, but it
I am doing Internet Scenario for Plant Maintenance(PM) module. In that I have to
I have an extensive maintenence plan on one sql server 2008 instance that I
I have a maintenance script in PHP that updates and repairs the database. In

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.