Another way we used in the past is to create a temporary table with the primary keys that we want to move, and use a while loop. Thus, you can do this in some block mode to avoid large transaction costs if you canceled it and it had to roll back.
Basically what you do is insert into tablename (...) select (...) from the name of the table where the primary key is used (select the top key 10000 from the tempted one)
the top 10000 you want in the secondary result set so that you can remove them from the temp table so that they are not processed again.
Another way is to use cursors to reduce the number of records that you are processing at the same time.
Another loop method would be to do something similar in a while loop.
declare @stop as int set @stop = (select count (primaryKey) from tableName, where primaryKey is not in destinstiontable)
while (@stop> 0) start a transaction
Paste into destinationTable (...) select (...) from sourcetable where primaryKey is not in (select primarykey from destination table)
commit
set @stop = (select count (primaryKey) from tableName, where primaryKey is not in destinstiontable) end
Not the most efficient, but it will work and should allow you to keep a transaction log. If you donβt need it, make sure you use the no lock keyword to not block other transactions when doing this big move (unless you use BCP or DTS, because they are much faster).
Some of what has been said is probably your best bet. Use a BCP, DTS, or some other volumetric instrument. If you can refuse indexes, it will accelerate work.
Joshua cauble
source share