How to stop data flow SSIS when there is a lookup match output and carry on when No Match Output

deanmachine333
deanmachine333 used Ask the Experts™
on
Hello ,

I have a SSIS package that imports data from spreadsheet into temp table by checking if the data ( year column ) doesn't exist in destination table then will insert data into table. I would like the package to stop if it finds a matching year in destination table.

what the data flow looks like
Excel Source --> Data Conversion --> Lookup --> OLE DB Destination


Kind regards
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
SQL Server Data Dude
Most Valuable Expert 2013
Author of the Year 2015
Commented:
>I would like the package to stop if it finds a matching year in destination table.
I'm not aware of any control that does a 'Stop the package if this expression happens', so what you could do is

  • Add a Row Count control after the lookup, assigning that row count to a variable (e.g. your_variable)
  • Add a precedence constraint (aka green arrow) immediately after the data flow task in question,with an expression of something like @[your_variable} == 0, which would mean that processing would only continue if that variable contained a zero.

Author

Commented:
thanks i have added this in the Control Flow.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial