How to do IF condition in SSIS package

Just followed this awesome blog to do this

Created a variable in package scope name it say UploadEnableFlag.

Created an Execute SQL task.

Configured this task to return Select count(*) as UploadEnableFlag from ControlTable.

Change the result set to Single row. Now you can add the Result Sets.

In Result Set tab, add a result set with name say UploadEnableFlag and map it with variable User::UploadEnableFlag.

Connect green line from this Execute Process Task to the task ( true condition).

Right click on this green line (called Precedence Constraint) and select Edit.

In Precedence Constraint Editor:

  • set evaluation operation as Expression
  • in Expression box write : @[User::UploadEnableFlag]>0

Connect another green line from this Execute Process Task to the task ( false condition).

In Precedence Constraint Editor:

  • set evaluation operation as Expression
  • in Expression box write : @[User::UploadEnableFlag]<=0

The package is ready for testing.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s