I am stumped. Can anyone tell me why this code goes into an infite loop and just keeps running and running. Using MSSQL. The idea is that it updates rows, in chunks, of a very large table ~ approx 32M rows. If I run this and stop it, the # of rows affected (when adding all the 250000 up) is greater than the total number of rows in the table. Only a small fraction of them are actually updated then too as it turns out.
set nocount off
set rowCount 250000
declare @LastUpdated int
While 1=1 begin
Update [table] set [column1] = null where [column1] = 0
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables.
Make a table:
Update a specific column given a specific row using the UPDATE statement:
Remove a set of values using the DELETE s…