• No problem. Anything with an @ in front is a variable. @ID would hold a value for each row of the table that somehow uniquely identifies that row. So, the cursor has you looping through all the duplicate values. Each time it gets to "Fetch Next Into @ID", it puts the next value into the variable.

    Then, the first time through the loop, it assigns that to @KeepID. And any subsequent loops, you would run all your logic to merge / move / delete the duplicate record.