How to perform an order logic in SSIS package for inserting value from
source to destination by an oder of column being not null
I have 4 columns in source table.
Source Table : Column 1, Column 2, Column 3, Column 4
Among those 4 columns from source table, I want to insert only 2 columns
in the destination table.
Destination table : has column A and Column B
To insert value in Column A and Column B. Now i want to perform order
operation in SSIS package.
So I want to have an oder logic in SSIS .
If there is a value in Column 1, then use that in Destination Column A and
insert from column 1 value into Column A . So, if there is value in Column
1, then Column A in destination table will be inserted.
IF there is no value in Column 1, then check the Column 2 in the source
table and if there is value in Column 2, insert that value in Column A.
Now suppose, Column 1 was null and Column 2 had value, Column 2 value will
be inserted into column A in the destination table.
Now check the column 3 in source and see if there is value, if it has
value then insert that value in Column B in Destination table. If there is
no value in Column 3 then check column 4 from source.
So basically check in those 4 columns in the order (which is specified)
and 1st value that we come across, use that in the destination Column A
and Column B.
There is tricky part is there, so 1st not null value goes into the
Destination column A and 2nd not null value goes into 2nd destination
column B, how can i figure it out which one is 2nd not null value?
I guess we can do this in SQL but I want to do in SSIS package.
I will really appreciate your help. Thank you in advance.
No comments:
Post a Comment