Lookup Transformation in SSIS

In this article, we are going to explain how to perform Lookup Transformation in SSIS using OLE DB Connection Manager with an example. In this example, we are going to use the OLE-DB Connection to connect with SQL Server and perform SSIS lookup operation.

TIP: Please refer the Lookup in SSIS article to understand the properties available in SSIS Lookup Transformation

Before we start creating the SSIS lookup transformation package, Let us see the Lookup table and its data.

Lookup Transformation in SSIS 0

Now let’s see the source data as well.

Lookup Transformation in SSIS 1

Configure Lookup Transformation in SSIS

STEP 1: Drag and drop the Data Flow Task from the toolbox to the control flow region. Next, rename it as Lookup Transformation in SSIS.

Lookup Transformation in SSIS 2

Double click on it, and it will open the data flow tab.

STEP 2: Drag and drop OLE DB Source from the toolbox to the data flow region. Double click on OLE DB source in the data flow region will open the connection manager settings

Lookup Transformation in SSIS 3

From the above screenshot, you can observe that We selected [SSIS Tutorials] Database in our SQL Server as a source database and [Lookup Transformation Source] as the source table

STEP 3: Click on the columns tab to verify the columns. In this tab, we can uncheck the unwanted columns also.

Lookup Transformation in SSIS 4

Click OK and Drag the SSIS Lookup Transformation from the toolbox to the Data Flow tab.

Lookup Transformation in SSIS 5

STEP 4: Double click on the SSIS Lookup Transformation will open the Lookup Transformation Editor. Use this to configure the lookup table (reference table).

In the SSIS lookup transformation General Tab, under “Specify how to handle rows with no matching entries.” Change the default Fail Component to Redirect rows to no match output option. Change this option to redirect all the unmatched rows to No match output. Otherwise, the package will Fail.

Lookup Transformation in SSIS 6

Under the connection type section, we selected the OLE DB Connection manager because we are using the SQL Server table as a reference table.

If you are using any cache file (.caw), then use the Cache Connection Manager. Please refer SSIS Lookup Transformation in Full Cache Mode article to understand, Howe to perform Lookup operations using Cache File in SSIS

Click on the connection Tab of the SSIS lookup transformation

STEP 5: If you already created the OLE DB connection Manager, then select from the list otherwise, Click the New button to configure it. Here we decided on the SSIS Tutorials Database.

Lookup Transformation in SSIS 7

For this example, We are using [Lookup Transformation Reference] table as the lookup table or reference table. Source data will compare with the data present in this table.

Lookup Transformation in SSIS 8

TIP: We should not use the whole table as a reference table for SSIS lookup. Perhaps you should use the SQL command to select the required column name you want to reference.

STEP 6: Click on the Available Input columns. And drag to the available lookup columns to create a join between the 2 data sets.

Lookup Transformation in SSIS 9

A country column in the source data will check against the [Country Name] column in the lookup table.

  • If each row of the Country column in the source data matches with any of one row of the lookup table [Country Name] column, that row will pass to the Matched Output.
  • If it does not match with any of one row of the [Country Name] column in the lookup table, then that row will be passed to No Match Output.

Sometimes we may have some extra columns in the lookup table which we want to pass to the matched output. In these situations, we have checkmark that column in Available lookup Columns as we did for the Cid column.

STEP 7: Drag and drop two OLE DB Destinations on to the data flow region, and then drag the Output Arrow to this new OLE-DB Destination. A popup window, Input Output Selection Window will appear prompting you to select the Input-Output type: either Lookup Match Output or Lookup No Match Output. Select Lookup Match Output and click OK.

Lookup Transformation in SSIS 10

When you drag another Output Arrow to OLE DB Destination 1, it will automatically allocate Lookup No Match Output to it.

Lookup Transformation in SSIS 11

STEP 8: Double click on OLE DB Destination opens the OLE DB Destination Editor. Select the OLE-DB Connection Manager and select [Lookup Transformation Matched Rows] table in the [SSIS Tutorials] Database to store the Matched Rows Data.

Lookup Transformation in SSIS 12

STEP 9: Click on the Mappings tab to check whether the SSIS Lookup Transformation source columns correctly mapped to the destination columns.

Lookup Transformation in SSIS 13

STEP 10: Now Double click on the OLE DB Destination 1 to configure the No match output. Here we are going to select [Lookup Transformation Unmatched Rows] table in the [SSIS Tutorials] Database to store the Not Matched Row Data.

Lookup Transformation in SSIS 14

Repeat STEP 9 and click OK to finish creating an SSIS Lookup Transformation Package.

Right-click on the Lookup Transformation in SSIS Package in the Solution Explorer and select Execute Package.

Lookup Transformation in SSIS 15

From the above screenshot, you can observe that our Lookup Transformation in SSIS Package has executed successfully. Let’s open the SQL Server Management Studio to view the Lookup Transformation Matched Rows data.

Lookup Transformation in SSIS 16

Let’s see the SSIS Lookup Transformation Unmatched Rows Data.

SSIS Lookup Transformation Using OLE DB Connection Manager 17

Comments are closed.