Question

I need to prevent loading data into my fact table if any of the incoming data has a [DateId] that already exists in the fact table. The field [DateId] is an integer value.

The Lookup action in SSIS allows you to fail on non-matches, but I actually need a failure if any match is found. How can I get the package to fail when there's a match?

Était-ce utile?

La solution

If you just want non-matches to flow through the lookup, just use the "Lookup No Match Output" to connect to the next component in your data flow.

Selecting Lookup No Match Output means only unmatched rows flow into your destination.

Since the Lookup Match Output isn't hooked up to anything, all that data will just "stop" there. This is the equivalent of the SQL pattern LEFT JOIN WHERE --some left column-- IS NULL.

Autres conseils

Use either a merge-join (with a conditional split) or a lookup with a nomatch output (without hooking the match to anything).

No answer after 8 years. I had the same issue today and I can't think of anything else than this workaround.

Context: Writing from excel to SQL Server. Need to fail if the date is already present. This is also the parent in the hierarchy of data flow tasks in the control flow so wanted the child transformations to not execute if the parent fails.

Workaround:

  • Created a dummy table with one row and 2 columns for date and description. Entered the value "1900-01-02 12:34:56.000" in date and put a description in the other column.
  • Passed the Lookup Match Output to another lookup which looks up the dates in excel to this dummy table and will fail eventually.

At least I'm able to fail this and avoid writing duplicate data to 6 other tables that are written as a part of the 6 other data flow tasks which would otherwise execute if the parent task does not fail.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top