-- create a copy of the old table structure (optional)
Select * Into NewTable From OldTable Where 1 = 2;
-- insert data from table A into table B
Insert Into NewTable (field1, field2, field3)
Select field1, field2, field3 From OldTable
Insert Into
DBName.SchemaName.NewTableName
(field1, field2, field3)
Select
field1, field2, field3
FROM
DBName.SchemaName.OldTableName
WHERE
[Condition Here]
tableAdapterA.Fill(dataTableA)
tableAdapterB.Fill(dataTableB)
For Each ro as ARow in DataTableA
bro as DataTableBRow = dataTableB.FindByID(ro.ID);
If bro Is Nothing Then
dataTableB.AddBRow(ro.value, ro.value, ro.value...)
Else
bro.ID = ro.ID
bro.value = ro.value
...
End If
Next
tableAdapterB.Update(dataTableB) 'update means "save", it performs INSERT as well as UPDATE