The Slowly Changing Dimension transformation in SSIS coordinates the inserting and updating records in data warehouse dimension tables. This transformation supports four types of changes, and in this article we will explain about SSIS Slowly Changing Dimension Type 0 (called as Fixed attribute).
SSIS Slowly Changing Dimension Type 0: If you want to restrict the columns to be unchanged then mark them as Fixed attribute. If your Dimension table members (Columns) are marked as Fixed attributes then it will not allow any changes to that columns (Updating Data) but, you can insert new records. This type of changing is very useful, For example we can mark the Employee Last Name, date of birth, Company Login details as fixed attributed because once we store those values they wont change for any employee. Before we step into the example, let us see the data inside our Dimension table.
Following screenshot will show you the data inside our [DimCustomer] table. You can get the same data by selecting TOP 10 records from [DimCustomer] table in [AdventureWorksDW2014] database.
Below image shows the data present in the [CustomerSource] table and we are going to insert or update these two records into the [DimCustomer] table.
If you observe the above screenshot, Last name of the Customer Alternative Key (AW00011011) has changed from ‘Yang’ to ‘Lue’ and We have a new record with Customer Alternative Key (AW00011011). Our task is to insert the new record and try to update the Last name of first record.
SSIS Slowly Changing Dimension Type 0 example
STEP 1: Open BIDS and Drag and drop the data flow task from the toolbox to control flow and name it as ssis Slowly Changing Dimension Type 0.
Double click on it will open the data flow tab.
STEP 2: Drag and drop OLE DB Source, Slowly Changing Dimension from SSIS toolbox to data flow region
STEP 3: Double click on OLE DB source in the data flow region will open the connection manager settings and provides space to write our SQL statement. Here we are using already created OLE DB Connection Manger and CustomerSource table present in the [SSIS Source] as the Source table. If you find any difficulty to configure the OLE DB Source then please refer OLE DB Source in SSIS article.
STEP 4: Click on columns tab to verify the columns. In this tab we can uncheck the unwanted columns also.
Drag and drop the blue arrow from OLE DB Source to Slowly Changing Dimension Transformation to connect the data.
STEP 5: Double-click the Slowly Changing Dimension transform to open the editor. Once you click on it, It will open Slowly Changing Dimension Wizard. First page is welcome page and If you don’t want to see this page again then Please tick the check box “Do not show this page again”. For now click Next
STEP 6: Select a Dimension Table and Keys: This page is used to configure the Dimensional table information.
Connection Manager: This option is used to provide the connection to the dimension table. Here we are using already created OLE DB Connection Manger and DimCustomer table present in the [SSIS Source] as the dimension table. You always have the luxury to change the connection by clicking the New button.
Table or View: This option is useful to select the Data Warehouse Dimension table or View on which you want to perform slowly changing operation. Here we are selecting DimCustomer table.
- Input Columns: Columns that are coming from the OLE DB Source Or column that you want to insert or update.
- Dimension Columns: Columns that are available in Dimension table.
- Key Type: In order to perform Slowly Changing Dimension we need at least one Business key and we all know that the Customer Alternative Key is the key columns. Please change the Key type from Not a Key Column to Business key as we shown below
STEP 7 – Slowly Changing Dimension Columns: This is the main page in this whole wizard. here we have
- Dimension Columns: All the columns that are available in Dimension table will be available in this section. Here you have to select the columns that you want to mark as Fixed attribute. From the below screenshot you can observe that, we are selecting the Last Name, Birth date and Email Address columns
- Change Type: Select the change type. In this example, we are discussing about SCD Type 0 so, we are keeping the default Fixed attribute as change type.
By default the wizard will assign the Fixed attribute as the Change Type but you can change them as we shown below.
STEP 8 – Fixed and Changing Attribute Options: This page has two option and the second option is grayed out for SCD Type 0. If there are any changes in the data (Dat coming from input column is different from Dimension table data) then:
- If you want to Fail the package then Please check mark the Fail the transformation if changes are detected in a fixed attribute option.
- If you don’t want to fail the package then unchecked this option. Note, unchecking this option doesn’t allow you to update the existing records but it will not fail the package
STEP 9 – Inferred Dimension Members: We will discuss this option in Slowly Changing Dimension Inferred Dimension article. For now, we are de-selecting this option and click Next button
STEP 10 – Finish the Slowly Changing Dimension Wizard: Click finish button to finish configuring the SSIS Slowly Changing Dimension Type 0
Once you click on the finish button our Data Flow will automatically changed. If you observe the below screenshot, it added the OLE DB Destination to insert new records into the Dimension table
(Optional Step): Let us double-click on the OLE DB Destination to check the automatically created destination (table name and connection manager setting and mappings).
Click OK to finish our SSIS Slowly Changing Dimension Type 0 package design. Let us run the package
From the above screenshot you can observe that, though there are two rows coming from the OLE DB Source, Only one row is inserted (No update is performed) here.
Let’s open the SQL Server Management Studio and check the results. If you observe the below records, our package added New record of customer Alternative key AW00011011 but it didn’t updated the Last name of AW00011001.
Let us see what will happen when we uncheck the Fail the transformation if changes are detected in a fixed attribute option.
Click OK to finish the SSIS Slowly Changing Dimension Type 0 package design and let us run the package. From the below screenshot you can observe that, the package has failed at Slowly Changing Dimension transformation.
Thank you for Visiting Our Blog