As a slight aside, I've had to do this before when the PK on my TableA could come into it in any order (not sequential). I just used the natural key and created a temp table:
INSERT TableB SELECT * FROM TableA WHERE TableA.ID IN (SELECT ID FROM #temp)
DELETE FROM TableA WHERE ID IN (SELECT ID FROM #temp)
Perhaps it may have been more efficient to build an IDENTITY column on my TableA and use the same solution here...