4.2.2 Type 2 Methodology
The Type 2 method tracks historical data by creating multiple records for a given natural key in the dimensional tables with separate surrogate keys. With Type 2, the historical changes in dimensional data are preserved. In the above example for the change in product name from 'PL' to 'Personal Loan' if history has to be preserved, then the V_PRODUCT_NAME column has to be set as Type 2 when SCD is processed for the processing period and the change inserts a new record as shown in the following example:
Table 4-3 Type 2 Methodology
N_PRODUCT_SKEY | V_PRODUCT_NAME | D_START_DATE | D_END_DATE | F_LATEST_RECORD_INDICATOR |
---|---|---|---|---|
1 | PL | 5/31/2010 | 12/31/9999 | N |
1 | Personal Loan | 6/30/2010 | 12/31/9999 | Y |
A new record is inserted into the product dimension table with the new product name. The latest record indicator for this is set as 'Y', indicating this is the latest record for the personal loan product. The same flag for the earlier record was set to 'N'.