This article supporting source code
We have implemented the import of data from Excel into the data flow target. That's the database, but we just simulate the data that's not duplicated, which is the data that doesn't exist at this time in the database. Then, if the data in Excel is the same as the primary key of the data in the database, Then insert operation will be an exception, how to implement automatic Update operation? That is, automatically determine the data source data, if the database exists on the implementation of the update, does not exist on the insert?
It may be misleading to call it merging data, and there is a difference between the combined data and the direct implementation of the merge and merge join components in the data stream, and first we look at the two components.
We create a new package, coincident with the name Mergedata, and then copy the components from the last Foreachinput package (including the Connection manager) in the control flow, delete the Foreach Loop container, and then modify the data flow to add two Excel data stream sources, respectively It is sorted by sort (according to the ProductNumber field), then the merge is added for data merging, three data viewers are added separately, and the modified flow diagram is as follows:
Let's do this, the parts of the three data viewer are shown below: