Generic loads generate multiple tables associated by at least one common field.
The code fragement you posted recombines those tables into one and drops the corresponding source tables, i.e. it generates one table that includes all fields generated by the generic load.
For pros and cons see also:
hope this helps
The code you have provided has the following descriptions:
Step 1) It loads distinct id and name from Table1
Step 2) Then with the help of 'for loop' it loads only that tablename which starts with 'Table2.' in the field 'Tablename'.
Step 3) With the help of next for loop, it loads all the contents from the tables iteratively, table name are retrieved from the variable 'vTable' which will loop till the last value of the field 'Tablename' and then the corresponding contents are left join to the table 'ResultTable' and then tables are dropped (since their contents are saved into another table named ResultTable)
Step 4) Then it drop the tables (Table1,TableList) to avoid the generation of synthetic keys.
and to know the concept of Generic Load you can refer the following thread
Thanks and Regards,