Search code examples
sql-serverssislookup

SSIS Lookup transformation Ignore Failure


In the dropdown 'Specify how to handle rows with no matching entries' I see 4 options to choose from:

  • Ignore failure
  • Redirect rows to error output
  • Fail component
  • Redirect rows to no match output

In the API I see only two options:

  • Treat rows with no matching entries as errors (0)
  • Send rows with no matching entries to the no match output (1)

This code accepts only 0 and 1:

lookupWrapper.SetComponentProperty("NoMatchBehavior", 1);

When I set the property to Ignore Failures, in the XML I see this

<property
  dataType="System.Int32"
  description="Specifies ..."
  name="NoMatchBehavior"
  typeConverter="LookupNoMatchBehavior">1</property>
<property

How to set a Lookup transformation to ignore failures in the API?

Update:

I compared all the differences in the resulting XML when I selected different options. There are two places that differ, in the lookup's NoMatchBehavior property and in the "Lookup Match Output" property errorRowDisposition.

                     errorRowDisposition  NoMatchBehavior
Fail Component       "FailComponent"      0
Ignore Failure       "IgnoreFailure"      0
Redirect To No Match  -                   1
Redirect To Error    "RedirectRow"        0

After this, sorting out the code is easy.

...
lookupWrapper.SetComponentProperty("NoMatchBehavior", 0);
...
lookupMatchOutput.ErrorRowDisposition = DTSRowDisposition.RD_IgnoreFailure;
...

Solution

  • To set a Lookup transformation to ignore failures in the API we need two things.

    1. set it to treat rows with no matching entries as errors
    2. ignore these errors in the output
    ...
    lookupWrapper.SetComponentProperty("NoMatchBehavior", 0);
    ...
    lookupMatchOutput.ErrorRowDisposition = DTSRowDisposition.RD_IgnoreFailure;
    ...