You are here: Decision Strategy Manager > Interaction History > Applying sample scripts for archiving and purging > Merging the dimension records in DB2 Database Software

Merging the dimension records in DB2 Database Software

Before you perform this task, make sure that all the dimension tables are created and have index on the PZID column.

  1. Connect to the target database.
  2. Merge the records from the temporary table to the actual dimension table.

    MERGE INTO PR_DATA_IH_DIM_<DIMENSION_NAME> T USING (SELECT column1 [, column2 ...] FROM <SOURCE_DATABASE>.<SOURCE_SCHEMA>.PR_DATA_IH_DIM_<DIMENSION_NAME>) S ON (T.PZID = S.PZID)WHEN NOT MATCHED THEN INSERT (column1 [, column2 ...]) VALUES (S.column1 [, S.column2 ...])

If you want to merge the dimension records from the source database to the target database, repeat this procedure for all the dimension tables.