In this article we are going to explain you, the Case Sensitivity problems occur while working with Lookup in SSIS with example. In this example we are going to use OLE DB Connection to connect with SQL Server 2014.
Before you start creating your package, Let us see the Lookup table in SQL Server, and its data before we start creating the package.
Now let’s see the source data as well.
If you observe the lookup and source table, Data is same but they differ in Case.
Configuring SSIS Lookup Transformation
STEP 1: Drag and drop the Data Flow Task from toolbox to control flow region and rename it as SSIS Lookup Transformation Case Sensitivity.
Double click on it and it will open the data flow tab.
STEP 2: Drag and drop OLE DB Source from toolbox to data flow region. Double click on OLE DB source in the data flow region will open the connection manager settings
From the above screenshot you can observe that, We selected [Employees] Database as source database and [Lookup Transformation Source] as source table
STEP 3: Click on columns tab to verify the columns. In this tab we can uncheck the unwanted columns also.
Click ok and Drag the Lookup Transformation from toolbox to the Data Flow tab.
STEP 4: Double click on the Lookup Transformation will open the Lookup Transformation Editor to configure the lookup table (reference table).
In the 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. By changing this option, Unmatched rows will be redirected to No match output otherwise, Package will Fail.
Under the connection type section we selected the OLE DB Connection Manager in SSIS because we are using SQL Server table as reference table. If you are using any cache file (.caw) then use Cache Connection Manager.
Click on the connection Tab
STEP 5: If you already created the OLE DB connection Manager then select from the list otherwise, Click New button and configure it. Here we selected Employees Database.
For this example, We are using [Lookup Table] table as the lookup table or reference table. Source data will be compared with the data present in this table.
TIP: We should not use whole table as reference table perhaps you should use 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.
Name column in the source data will check against the [Ref Name] column in the lookup table.
- If each row of the Name column in the source data match with any one row of the [Ref Name] column in the lookup table then that row will be passed to Matched Output.
- If each row of the Name column in the source data does not match with any one row of the [Ref 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 to check mark that column in Available lookup Columns.
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 pop up 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.
When you drag another Output Arrow to OLE DB Destination 1 then it will automatically allocate Lookup No Match Output to it.
STEP 8: Double click on OLE DB Destination will open the OLE DB Destination Editor. Select the OLE DB Connection manager and select [Case Matching Rows in Lookup Transformation] table in the [Employees] Database to store the Matched Rows Data.
STEP 9: Click on Mappings tab to check whether the source columns are exactly mapped to the destination columns.
STEP 10: Now Double click on the OLE DB Destination 1 to configure the No match output. Here we are going to select [Case Not Matching in Lookup Transformation] table in the [Employees] Database to store the Not Matched Row Data.
Repeat STEP 9 and click ok to finish creating SSIS Lookup Transformation Case Sensitivity Package.
Right click on the SSIS Lookup Transformation Case Sensitivity Package in the Solution Explorer and select Execute Package.
Let’s open the SQL Server Management Studio to view the Matched data. Although, each row in the source data matching with the lookup table, it displayed only one row as match data. To get rid of these situations use Character Map Transformation in SSIS to convert all the source data into either lowercase or uppercase.
Let’s see the Unmatched Data
If you observe from the above screenshot, all the rows which or not in lower case are treated as non-matching output.
Thank you for Visiting Our Blog