Conditional Test at Start?

  • I want to do something that seems like it should be easy, but I don't see an obvious way to do it in SSIS.

    I want the very first step to be querying two dates from two databases.  If Date A is more recent that Date B, I'll do a data export and transformation to flat files. If Date B is more recent I'll just insert getdate() into the table Date B was from and end the job without running any exports. 

    But looking at the Interface I don't see an obvious way to do that.   What would you suggest?

  • dan-572483 - Monday, April 9, 2018 12:02 PM

    I want to do something that seems like it should be easy, but I don't see an obvious way to do it in SSIS.

    I want the very first step to be querying two dates from two databases.  If Date A is more recent that Date B, I'll do a data export and transformation to flat files. If Date B is more recent I'll just insert getdate() into the table Date B was from and end the job without running any exports. 

    But looking at the Interface I don't see an obvious way to do that.   What would you suggest?

    Create two package-scoped variables, var 1 and var 2, to hold the dates.

    • Task 1: Get date 1 into var 1 using an ExecuteSQL task.
    • Task 2: Get date 2 into var 2 using an ExecuteSQL task.
    • From Task 2, branch to your conditional tasks using precedence constraints which have been defined as 'Expression and Constraint'. (The Expressions will be Var 1 > Var 2 on one of the constraints and Var 1 <= Var 2 on the other.)

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply