Update many rows with minimal footprint on the server

Quoting this solution for efficiently updating or deleting in batches, should it be needed…
(Just ran out of memory)