SQL Server Integration Services (SSIS) - Merge Join Transformation in SSIS


In this article we are going to see how to use the Merge Join Transformation in SSIS packaging. Merge Join Transformation is similar to merge transformation; it handles multiple data from different sources and merges into one process and handles it as if it came from a single source. Also Merge simply recombines portions of the data flow without changing the shape of the buffer, much like a UNION but which maintains the sort order. A Merge Join adds elements to the buffer which will change its shape, similar to an INNER, LEFT OR RIGHT OUTER JOIN. Let's jump start to see this sample of how to set the properties of the sorting.
You can look into my series of articles on SSIS at the url - http://f5debug.net/all-articles/


Follow steps 1 to 3 on my first article to open the BIDS project and select the right project to work on an integration services project. Once the project is created, we will see how to use the Merge Join Transformation task. Once you open the project, just drag and drop both a Merge Join transformation control and a source provider as shown in the image below:

Here I configured the source data source from 2 different files as shown below:

Source 1:


Source 2:


Now I created a table in the database and hosted it as the destination database as shown below:


Create table ProductMaster
Productid int,
Productname varchar(50),
ProductDate datetime,
ProductLineId int,
ProductOrderID int,
Productorderdetail varchar(40)
Select * from ProductMaster
Now the source files are configured and the sorting properties are enabled as shown in my previous article. Now let us configure the Merge join task as shown below:

Here I make an inner join to perform the task and I select productid as the primary key and select the list of columns that the destination table should have to be updated as shown in the above image. Now the task is configured and ready for data. Now we need to have a destination system to update the data so we will have the OLEDB destination provider as shown in the below screen and we configure it with the exact mapping.

Now the complete package is ready to build and execute. Press F5 to do the process, you will see the screen as below:

Now let's see how it got affected in the table. Run the destination system query and see the end result which will be like below:


So in this article we have seen how to use the Merge Join transformation task and the key configurations used in order to use this task easily.

Similar Articles