You receive the following data in a .txt file:
A second file contains the following data:
You want to merge those records into a single dataset in MySQL with the following columns:
Remember that the data to be merged with a Union transformation must have the same data type, precision, and scale.
To merge the files with a Union transformation, complete the following steps:
Ensure that the source files reside in a location accessible to your Secure Agent.
Define a connection to access the .csv files.
Create a mapping in the Mapping Designer.
Add two Source transformations to the mapping to connect to data in the .csv files.
Add a Union transformation and connect the Source transformations to it.
In the Union transformation Properties, perform the following steps for each input group:
In the Field Rules section, click the group you want to configure.
(Optional) For the incoming fields, select the fields you want to merge in the output.
The following image shows the selected fields in the first input group:
The following image shows the selected fields in the second input group:
If you do not specify a rule to exclude fields, at run time, the task ignores any fields that you do not map to the output fields.
Edit the Output field names in the Union transformation, to correspond to the field names that you want in the target:
You can also select fields, change metadata, add other fields, or convert the field types, for example, from integer to number.
In the Field Mapping of the Union transformation, ensure that the fields are correctly mapped for each input group:
Add a Target transformation to the mapping.
Connect the Union transformation to the Target transformation.
In the Target transformation field mapping, select automatic field mapping:
When complete, the mapping appears similar to the following image: