I am trying to insert rows between datatables. However, the way I have it now is very inefficient as it takes up a lot of time and memory to complete the process.
here is an example of how I am using my code:
For Each row As DataRow In temptable.Rows
Insert statement
select ID statement- for each iteration to show the number of rows has changed
5 more insert statements with the ID column number being used in the individual_ID column of each table.
Next
I am breaking up tables based upon their columns. I am using an Individual_ID in each table so that corresponding records will be selected as well.
What I want to know is can I do something similar with bulk copy where I can import to each table and have the Individual_ID inserted as rows are added, or there another way?
What I have tried:
I have tried to rule out insert statements by using
if dt.columns.contains then
statement. It does improve the time, however, it is still slow.