MERGE Transformation in SSIS with Example



In this post we are gonna discuss about MERGE transformation. MERGE in SSIS is equal to UNION ALL in SQL Server. This transformation unions two datasets/tables.The merge Transformation combines two sorted dataset into single dataset. Highlighted the text SORTED in last statement because “It is not possible to use MERGE when the inputs are NOT SORTED”. There is one more transformation which is very similar to this i.e UNION ALL. The Merge Transformation is similar to the union all transformations. Use the union all transformation instead of the merge transformation in the following situations.

  • The transformation inputs are not sorted
  • The combined output does not need to be sorted.
  • The transformation has more than two inputs.
MERGE takes ONLY TWO inputs where as UNION ALL can take more than two. Now lets see how to configure MERGE transformation with an example.
I created TWO tables with names MergeA and MergeB and inserted few records into each table as shown below.
  • Open a new project and drag a Data Flow task from toolbox in Control Flow.
  • Edit the Data Flow task by double clicking the object or by selecting EDIT button on Right click on the object. Make sure the Data Flow Page is opened as shown below.

  • Select TWO OLE DB data sources from data flow sources and drag and drop it in the data flow.
  • Double click on the OLE DB data source to open a new window where we can set the properties of the connection.
  • Select the connection manager and click on new button to set the connection string to the TWO tables as shown below.
  • Set the connecteions to the TWO tables created using TWO OLE DB data sources.
  • As said earlier, we need to SORT the data before giving as input to the MERGE transformation and hence drag and drop TWO SORT transformations into Data Flow pane and provide output of each OLE DB source to each Sort transformation as shown below.
  • Open the SORT configuration and select the Checkbox as EmpNo which means the SORT will happen on EmoNo column a s shown below and apply the same in both the SORT transformations. Also provide sort type as either Ascending or Descending as per your requirement.
  • The Input data from both the sources is SORTED now and hence add MERGE transformation to the pane and provide OUTPUT of both sort transformations as input to MERGE transformation as shown below.
  • Now drag and drop Flat File Destination to see the output on file, make connection between the Merge and the Flat File Destination as shown above.
  • Double click on the Flat File Destination to configure, In CONNECTION MANAGER select the NEW Option to set file path of the file and Click OK. If you select a file which already Exists then it will take that file else a NEW file will be created.
  • Check the mappings between Available Input Columns and Available Destination Columns and click OK.
  • Now the Package is ready which pulls the data from TWO tables then sorts and then mergers the data that is coming from two sources before copying to destination file. Trigger the packages and make sure all turns to GREEN.
  • Now open the file and see the data copied into the file which is coming from TWO sources.
In the above example I have taken OLE DB sources and Flat file destination to explain MERGE transformation. You can use any SOURCE and DESTINATION types depending on your requirements. The key things to keep in mind while using MERGE transformation –
  • Same number of columns should be there in both the sources.
  • Same data types should be present for mapping columns.
  • Data should be sorted before giving as input to MERGE.
That’s it .. as simple as this .. Try and Enjoy .. 🙂


Roopesh Babu V



  1. In patients taking potent inhibitors of CYP3A such as ketoconazole, and itraconazole, avoid use of tadalafil tablets see Clinical Pharmacology 12 generic cialis 5mg If your blood pressure drops too low, the results can be fatal Padda, 2021

  2. Diversity of the distal right ureter congruous with epididymo-orchitis related this past history effects of levitra professional of malaise, left-sided flank pain, and infection are minor side effects associated with ureteropyeloscopy cialis without prescription If that s the case, write about it

  3. Analysis of Tamoxifen firms and the main strategies used by the major players Teva Pharmaceutical Industries Ltd, AstraZeneca plc, Aegis pharmaceuticals, Watson laboratories, Inc generic cialis 5mg VPAP variable positive airway pressure VPAP II ST A bilevel flow generator V scan by Intl

  4. UK Lisa Smyth, Concern that patients could turn to black market dealers if no deal Brexit leads to Lyrica shortage, Belfast Telegraph, 14 September 2019 cialis prescription Rivera stepped forward, tipped his cap, and won over many fans with his good natured response

  5. 8 Abamectin Abanquil Abanoquil mesylate Abapresin Guanethidine sulfate Abbocillin Penicillin G procaine Abbofinase Urokinase Abbokinase Urokinase Abboticine Erythromycin stearate Abbott 44747 Astromicin sulfate Abbott 85761 Atreleuton Abbutol Ethambutol hydrochloride Abcid Sulfadimethoxine Abecarnil Abecarnil Abedine Carnitine Abeformin T Tolbutamide Abehol Chlophedianol Abehol Clofedanol hydrochloride Abemide Chlorpropamide Aberel Tretinoin Abesta Reserpine Abetol Labetalol hydrochloride Abicorten Isoflupredone Abilify Aripiprazole Abilit Sulpiride Abilitat Aripiprazole Abiocine Dihydrostreptomycin sulfate Abiraterone Abiraterone Abirol Methandrostenolone Abitrexate Methotrexate Abminthic Dithiazanine iodide Abomacetin Erythromycin Aboren Midecamycin Abovis Aclatonium napadisylate AB PC Ampicillin trihydrate Trade Name Index Each trade name listed below is followed by the generic name of the pharmaceutical to which it pertains 3710 Abricycline Tetracycline Abrol Acetaminophen Abrolet Acetaminophen Abronquil Fenspiride Absentol Trimethadione Abstenil Disulfiram Abstinyl Disulfiram ABT 378 Lopinavir Abunidazole Abunidazole Acamol Acetaminophen Acantex Ceftriaxone sodium Acaporina Cephaloridine Acaprazine Acaprazine Acaxina Cephalexin Accenon Ethotoin Accent Furosemide Accolate Zafirlukast Accupril Quinapril hydrochloride hydrate Accupro Quinapril hydrochloride hydrate Accutane Isotretinoin Accu Tap Acetaminophen Ace Methscopolamine bromide Acebitor 5 Lisinopril Acecainide Acecainide Aceclofenac Aceclofenac Acecor Acebutolol Acedicone Thebacon Acef Cefazolin sodium Acefluranol Acefluranol Acelat Spironolactone Ace Line Iopanoic acid Acemin Chlorpromazine hydrochloride Acemin Lisinopril Acenol Nicomol Aceon Perindopril erbumine Aceperone Aceperone Acephen Acetaminophen Aceprometazine Aceprometazine Acertil Perindopril erbumine Acerum Pivampicillin Acesal Aspirin Acespar 200 Sparfloxacin Acesulfame K Acesulfame potassium Acesulfame Potassium Acesulfame potassium Acesulphame K Acesulfame potassium buy priligy paypal Volume overload can also result in secondary hypertension

  6. what is viagra pill You should not take this medicine if you are allergic to Doxycost or to other tetracycline antibiotics such as demeclocycline Declomycin, minocycline Dynacin, Minocin, Solodyn, Vectrin, or tetracycline Brodspec, Panmycin, Sumycin, Tetracap


Please enter your comment!
Please enter your name here

+ 76 = 85