Here's what I would do (Sybase / SQL Server syntax):
DECLARE @total_rows int
SELECT @total_rows = count(*)
FROM Source_Table
WHILE @total_rows > (SELECT count(*) FROM Target_Table)
BEGIN
SET rowcount 1000
print 'inserting 1000 rows'
INSERT Target_Table
SELECT *
FROM Source_Table s
WHERE NOT EXISTS( SELECT 1
FROM Target_Table t
WHERE t.id = s.id )
END
set rowcount 0
print 'done'
Or you could do it based on IDs (assumes Id is a number):
DECLARE @min_id int,
@max_id int,
@start_id int,
@end_id int
SELECT @min_id = min(id) ,
@max_id = max(id)
FROM Source_Table
SELECT @start_id = @min_id ,
@end_id = @min_id + 1000
WHILE @end_id <= @max_id
BEGIN
print 'inserting id range: ' + convert(varchar,@start_id) + ' to ' + convert(varchar,@end_id)
INSERT Target_Table
SELECT *
FROM Source_Table s
WHERE id BETWEEN @start_id AND @end_id
SELECT @start_id = @end_id + 1,
@end_id = @end_id + 1000
END
set rowcount 0
print 'done'