The SSIS OLE DB Destination is used to load data into variety of database tables or views or SQL Commands. OLE DB destination editor provides us the choice to select the existing table(s), View(s) or you can create new table. In this article we will show you, How to configure SSIS OLE DB destination to load or store data into the SQL Server Database.
NOTE: The SSIS OLE DB Destination uses OLE DB Connection Manager to create connection with relational databases
Configuring SSIS OLE DB Destination
STEP 1: Drag and drop the data flow task from the toolbox to control flow and rename it to SSIS OLE DB Destination.
Double click on it will open data flow tab.
STEP 2: Drag and drop OLE DB Source and OLE DB destination on to the data flow region. In this example, we will explain about OLE DB destination only so, Please refer OLE DB Source in SSIS article to understand the steps involved in creating it.
Before we start, Double click on OLE DB source to see the SQL Command we used. From the below screenshot you can see that, we are using the [Dim Products] and [Fact Internet Sales] tables present in the Adventure Works DW 2014 database
SQL Command we used in the above screenshot is:
[DimProduct] AS PROD ON
[FactInternetSales].[ProductKey] = PROD.[ProductKey]
STEP 3: Double-click on the OLE DB Destination will open the to OLE DB Destination Editor to configure the target database. Below screenshot will show you the list of available options in Connection Manager tab:
- OLE DB Connection Manager: Here you have to select the existing OLE DB Connection Manager (if any) otherwise, click on new button to create one. For this example, we are using the already created Connection manager.
- Name of the table or the View: Here you have to select the existing table or view to store the data otherwise, click new button to create new destination table.
- Keep Identity: Please specify whether you want to load the identity values into the destination table or not by checking this option. This option is available only for the fast loads and it is unchecked by default.
- Keep Nulls: Please specify whether you want to load the NULL values into the destination table or not by checking this option. This option is available only for the fast loads and it is unchecked by default.
- Table Lock: While loading the data, Please specify whether you want to Lock the destination table or not
- Check Constraints: While loading the data, Please specify whether the destination table Check Constraints or not.
- Rows Per Batch: Please specify the number of rows you want to send in per batch. In real-time, it is always advisable to specify the value and this can improve your performance.
- Maximum insert commit size: Please specify the maximum batch size here.
STEP 4: Within the Data Access Mode we have multiple options and we have to select one of the following options to load data into the OLE DB destination:
- Table or View: Select this option to load data into the table or View.
- Table or View – Fast Load: Select this option to load data into the table or View and use the fast load option.
- Table name or View name Variable: Select this option, if you stored your destination table or View name inside the Variable and use the fast load option.
- Table name or View name Variable – Fast Load: Select this option, if you stored your destination table or View name inside the Variable.
- SQL Command: Load the data into SSIS OLE DB destination using the custom SQL Command
NOTE: In your OLE DB Connection Manager
- If you are using Microsoft OLE DB provider to access the SQL Server then you have to use Fast load option, it means either you can use option 2 or 4.
- If you are using SQL Server Native Client to access the SQL Server then you can use either option 1, 3.
STEP 5: If you click on the down arrow button beside the Name of the table or the View option, it will display the list of available Tables and Views present in the current connection manager as shown below.
For the time being we are selecting the existing table Table called [SSIS OLE DB Destination]. If you haven’t created the table before or you want to create new table for this example then click on the New button as we shown below. This will open the new window to write your custom SQL Query to Create New table.
View Existing Data..: This button will help you to see the already existing data in your target table.
STEP 6: Click on Mappings tab to check whether the source columns are exactly mapped to the destination columns.
NOTE: If your input column names and destination column names are same then, the intelligence will automatically map. if there is any changes in the column names (any alias columns or any calculated columns) then we have map them manually.
STEP 7: Clicking OK to finish configuring SSIS OLE DB Destination package. Let us run the package and see whether we transferred the data from OLE DB Source to OLE DB Destination or not
Let us open the SQL Server Management Studio Query window to Preview the data. From the below screenshot you can observe that we successfully loaded the incoming data into SQL Server table using SSIS OLE DB Destination.
Thank you for Visiting Our Blog