Scenario:
We are loading data from source file to our SQL Server table. After the load we want to send email if number of records loaded are more than 5.
Solution:
We will be using Precedence Constraint with expressions to handle this scenario. Here is step by step approach.
Step 1:
Create a variable RowCnt with scope= Package level as shown below. We will be using this variable in expressions to make decision to send email or not.
Step 2:
Bring data flow task on Control Flow pane and then build as shown below. It should be extracting from Source File, Row Count Transformation will be using RowCnt variable to capture rows moved between source and destination. Use OLE DB Destination to insert data into SQL Table.
Choose Control Flow and connect Data flow task to Send Mail Task. After connecting them, double click on green connection ( Precedence constrain) and write expression as shown below.