SSIS Branching

  • I think I'm missing a simple way to branch in a ssis package. I want to load a recordset in a table, however I want to do some logic first that tells me the current recordset count in the non local table table and the current record count in the local set. IF the recordset in the non local table is larger that the one in the local table I want to pull the new recordset in.

    it's the branching that has me stuck.

    I can get the record counts out into a variable and I KNOW that they work... and i tried

    if (newRecCount > currRecCount) Then

    Dts.TaskResult = Dts.Results.Success

    else

    Dts.TaskResult = Dts.Results.Failure

    end if

    I just get an error on this. (assume the variables have been defined and will messagebox out correctly, above the code shown)

    can someone show me the light?

  • After getting the record counts, set the value of a Package Level variable in a script task, eg, in pseudo code:

    User::ProcessImport = "False"

    If (condition) then User::ProcessImport = "True"

    In your control flow window, create two 'Success' paths after this script task. Double-click on the line from the script task to the next task and the Precedence Constraint Editor will be displayed. Change Evaluation Operation to Expression and Constraint and change Expression to @[User::ProcessImport] == "True" on the 'true' path and ... != "True" on the 'false' path.

    I don't think you should be trying to fail the package, just because you do not want it to continue processing.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Phil Parkin (3/31/2009)

    I don't think you should be trying to fail the package, just because you do not want it to continue processing.

    Perfect! works great. I knew I was missing something. I didn't think this was necessarily the proper path but I was attempting to work it out A pathway (any pathway) before just asking a question. 🙂 better than asking w/o any attempt. heh heh Thank you again!

  • Great, thanks for the feedback & agree with your comments - you learn more by trying, even if it doesn't work out ... 🙂

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

Viewing 4 posts - 1 through 3 (of 3 total)

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