do you have a key column on your source data?1. create temp dbcreate TABLE [dbo].migration_temp(KeyField int not null)GO
2. Create a processing table that holds all rows that you want to move based on a key fieldcreate table dbo.Process(keyFieldId int NOT NULL, isProcessed bit NOT NULL default((0)))
3. Dump into Process all unique keyField values insert into dbo.Process(keyFieldID) SELECT keyFieldID FROm SourceTableView
4.dump batch rows into temp table WHILE (SELECT COUNT(*) FROM dbo.Process WHERE isProcessed = 0) > 0 INSERT INTO dbo.migration_temp(KeyField) SELECT TOP 100 KeyFieldID FROM dbo.Process with (nolock) WHERE isProcessed = 0
6. Batch process your code7. Update process table UPDATE tgt SET tgt.isProcessed = 1 FROM dbo.Process tgt with (nolock) inner join dbo.migration_temp src on src.KeyFieldID= tgt.KeyFieldID
If you don't have the passion to help people, you have no passion