How to write if condition

  • How to write the if condition in the sript task in SSIS package

    the logic is if table name is not 'EMP' then continue running the packge
    if table name is EMP  then don't end the package should continue.

    if (Dts.Variables["User::var"].Value.ToString() == "EMP")

    {
    ????

                   

  • mcfarlandparkway - Thursday, March 9, 2017 4:07 PM

    How to write the if condition in the sript task in SSIS package

    the logic is if table name is not 'EMP' then continue running the packge
    if table name is EMP  then don't end the package should continue.

    if (Dts.Variables["User::var"].Value.ToString() == "EMP")

    {
    ????

                   

    So if either condition is true, you want to continue running the package? What is the point of this?

    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

  • I believe that you're looking for functionality given by precedence constraints. These are the arrows that define the order of the tasks (you can double click on them).

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Is there any reason why you would need a Script package to do this? You could change your evaluation operation to the next task in your Control Flow to Expression and Constraint. Then set the Value to Success (assuming that you are continuing in a Success), and then put an expression of something like:
    @[$User:var] == "EMP" ? TRUE : FALSE
    Also set your logical operator to what you require (Probably AND).

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

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

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