I have a Data migration mapping table that maps source to target attributes, example shown below:
Table1
Source | Target |
SFName | TFName |
SLName | TLName |
SDOB | TDOB |
Idea is to compare the attributes based on a join condition to identify the attributes that are different. For e.g. X1 and X2 are actual source and target tables (with actual migrated data). Table1 stores just the column names for corresponding source and target.
Select SFName,TFName, SLName,TLName,SDOB, TDOB from Table1
Where X1.ID = X2.ID
And (SFName<>TFName
Or SLName <> TLName
Or SDOB <> TDOB)
I want to construct the above query dynamically by doing a lookup on the mapping table. So if we remove or add a mapping in/from mapping table the actual query in the code is not impacted.
What would be the most efficient way to do this in SSIS (SQL Server 2012)