I am pretty sure that everyone run into to the task of comparing 2 versions of the data. Though I have created databases in the past for the comparison, the limitation is that from time to time the table changes and so the fields in the tables (example: in one project it required to determine changes in sales forecast, another project requires to determine changes in project dashboards)
I am seeking help and guidance from the experts in this group to help design a dynamic tool for the following requirements.
1. flexibility for the user to select tables (in different dbs and directories)
2. identify the primary key (may have more than 1 field) in for the tables)
(Assuming both source 1 and source 2 have same data structure, may have additional fields but primary key combination should be same)
3. Prompt user to select the field they want to compare (default should be all the fields)
4. Create a resultant table showing the change details (all records form the source1 (S1) and source2 (S2)
Example:
step 1: user selects 2 tables in 2 different database with different table names but same table structure and same primary key combination.
[TABLE="width: 229"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD="colspan: 3"]Table: Source_1[/TD]
[/TR]
[TR]
[TD]Key[/TD]
[TD]Group[/TD]
[TD]Score[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]X[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]Y[/TD]
[TD]9[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]Z[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]P[/TD]
[TD]Z[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]R[/TD]
[TD]e[/TD]
[TD]4[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 267"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD="colspan: 3"]Table: Source_2[/TD]
[/TR]
[TR]
[TD]Key[/TD]
[TD]Group[/TD]
[TD]Score[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]z[/TD]
[TD]9[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]Z[/TD]
[TD]12[/TD]
[/TR]
[TR]
[TD]D[/TD]
[TD]h[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]E[/TD]
[TD]x[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]R[/TD]
[TD]e[/TD]
[TD]4[/TD]
[/TR]
</tbody>[/TABLE]
Output:
[TABLE="width: 756"]
<colgroup><col><col><col><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD="colspan: 9"]Table: ComparisonS1S2[/TD]
[/TR]
[TR]
[TD]Rcd Source[/TD]
[TD]Key[/TD]
[TD]Group_1[/TD]
[TD]Group_2[/TD]
[TD]Group_ChngFlag[/TD]
[TD]Score_1[/TD]
[TD]Score_2[/TD]
[TD]Score_ChngFlag[/TD]
[TD]OverallChangeFlag[/TD]
[/TR]
[TR]
[TD]S1[/TD]
[TD]A[/TD]
[TD]X[/TD]
[TD]Null[/TD]
[TD]Changed[/TD]
[TD]8[/TD]
[TD]0[/TD]
[TD]Changed[/TD]
[TD]Changed[/TD]
[/TR]
[TR]
[TD]S1-S2[/TD]
[TD]B[/TD]
[TD]Y[/TD]
[TD]z[/TD]
[TD]Changed[/TD]
[TD]9[/TD]
[TD]9[/TD]
[TD]Same[/TD]
[TD]Changed[/TD]
[/TR]
[TR]
[TD]S1-S2[/TD]
[TD]C[/TD]
[TD]Z[/TD]
[TD]Z[/TD]
[TD]Same[/TD]
[TD]10[/TD]
[TD]12[/TD]
[TD]Changed[/TD]
[TD]Changed[/TD]
[/TR]
[TR]
[TD]S2[/TD]
[TD]D[/TD]
[TD]Null[/TD]
[TD]h[/TD]
[TD]Changed[/TD]
[TD]0[/TD]
[TD]10[/TD]
[TD]Changed[/TD]
[TD]Changed[/TD]
[/TR]
[TR]
[TD]S2[/TD]
[TD]E[/TD]
[TD]Null[/TD]
[TD]x[/TD]
[TD]Changed[/TD]
[TD]0[/TD]
[TD]6[/TD]
[TD]Changed[/TD]
[TD]Changed[/TD]
[/TR]
[TR]
[TD]S1[/TD]
[TD]P[/TD]
[TD]Z[/TD]
[TD]Null[/TD]
[TD]Changed[/TD]
[TD]3[/TD]
[TD]0[/TD]
[TD]Changed[/TD]
[TD]Changed[/TD]
[/TR]
[TR]
[TD]S1-S2[/TD]
[TD]R[/TD]
[TD]e[/TD]
[TD]e[/TD]
[TD]Same[/TD]
[TD]4[/TD]
[TD]4[/TD]
[TD]Same[/TD]
[TD]Same[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
</tbody>[/TABLE]
Note: rcd source tells which table source had the data so its legend
S1 : rcd was present just in Source 1
S2 : rcd was present just in Source 2
S1-S2: record is present in both the sources
I look forward to the guidance to develop this tool or please advice if this is already available somewhere.
Thanks in advance
regards
SKV
I am seeking help and guidance from the experts in this group to help design a dynamic tool for the following requirements.
1. flexibility for the user to select tables (in different dbs and directories)
2. identify the primary key (may have more than 1 field) in for the tables)
(Assuming both source 1 and source 2 have same data structure, may have additional fields but primary key combination should be same)
3. Prompt user to select the field they want to compare (default should be all the fields)
4. Create a resultant table showing the change details (all records form the source1 (S1) and source2 (S2)
Example:
step 1: user selects 2 tables in 2 different database with different table names but same table structure and same primary key combination.
[TABLE="width: 229"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD="colspan: 3"]Table: Source_1[/TD]
[/TR]
[TR]
[TD]Key[/TD]
[TD]Group[/TD]
[TD]Score[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]X[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]Y[/TD]
[TD]9[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]Z[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]P[/TD]
[TD]Z[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]R[/TD]
[TD]e[/TD]
[TD]4[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 267"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD="colspan: 3"]Table: Source_2[/TD]
[/TR]
[TR]
[TD]Key[/TD]
[TD]Group[/TD]
[TD]Score[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]z[/TD]
[TD]9[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]Z[/TD]
[TD]12[/TD]
[/TR]
[TR]
[TD]D[/TD]
[TD]h[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]E[/TD]
[TD]x[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]R[/TD]
[TD]e[/TD]
[TD]4[/TD]
[/TR]
</tbody>[/TABLE]
Output:
[TABLE="width: 756"]
<colgroup><col><col><col><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD="colspan: 9"]Table: ComparisonS1S2[/TD]
[/TR]
[TR]
[TD]Rcd Source[/TD]
[TD]Key[/TD]
[TD]Group_1[/TD]
[TD]Group_2[/TD]
[TD]Group_ChngFlag[/TD]
[TD]Score_1[/TD]
[TD]Score_2[/TD]
[TD]Score_ChngFlag[/TD]
[TD]OverallChangeFlag[/TD]
[/TR]
[TR]
[TD]S1[/TD]
[TD]A[/TD]
[TD]X[/TD]
[TD]Null[/TD]
[TD]Changed[/TD]
[TD]8[/TD]
[TD]0[/TD]
[TD]Changed[/TD]
[TD]Changed[/TD]
[/TR]
[TR]
[TD]S1-S2[/TD]
[TD]B[/TD]
[TD]Y[/TD]
[TD]z[/TD]
[TD]Changed[/TD]
[TD]9[/TD]
[TD]9[/TD]
[TD]Same[/TD]
[TD]Changed[/TD]
[/TR]
[TR]
[TD]S1-S2[/TD]
[TD]C[/TD]
[TD]Z[/TD]
[TD]Z[/TD]
[TD]Same[/TD]
[TD]10[/TD]
[TD]12[/TD]
[TD]Changed[/TD]
[TD]Changed[/TD]
[/TR]
[TR]
[TD]S2[/TD]
[TD]D[/TD]
[TD]Null[/TD]
[TD]h[/TD]
[TD]Changed[/TD]
[TD]0[/TD]
[TD]10[/TD]
[TD]Changed[/TD]
[TD]Changed[/TD]
[/TR]
[TR]
[TD]S2[/TD]
[TD]E[/TD]
[TD]Null[/TD]
[TD]x[/TD]
[TD]Changed[/TD]
[TD]0[/TD]
[TD]6[/TD]
[TD]Changed[/TD]
[TD]Changed[/TD]
[/TR]
[TR]
[TD]S1[/TD]
[TD]P[/TD]
[TD]Z[/TD]
[TD]Null[/TD]
[TD]Changed[/TD]
[TD]3[/TD]
[TD]0[/TD]
[TD]Changed[/TD]
[TD]Changed[/TD]
[/TR]
[TR]
[TD]S1-S2[/TD]
[TD]R[/TD]
[TD]e[/TD]
[TD]e[/TD]
[TD]Same[/TD]
[TD]4[/TD]
[TD]4[/TD]
[TD]Same[/TD]
[TD]Same[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
</tbody>[/TABLE]
Note: rcd source tells which table source had the data so its legend
S1 : rcd was present just in Source 1
S2 : rcd was present just in Source 2
S1-S2: record is present in both the sources
I look forward to the guidance to develop this tool or please advice if this is already available somewhere.
Thanks in advance
regards
SKV