Basically I need to run this on a table with 40 million rows, updating every row at once will crash, so I want to batch the query so that if it crash, it can re-run the quer
Declare @Rowcount INT = 1;
WHILE (@Rowcount > 0)
BEGIN
UPDATE TOP (100000) [table] --<-- define Batch Size in TOP Clause
SET [New_ID] = [Old_ID]
WHERE [New_ID] <> [Old_ID]
SET @Rowcount = @@ROWCOUNT;
CHECKPOINT; --<-- to commit the changes with each batch
END