--Delete computer based on agreed list

declare @ComputerID int
declare cur CURSOR LOCAL for
    select ComputerID from [DuplicateList] where recommendation = 'Delete inventory'

open cur

fetch next from cur into @ComputerID

while @@FETCH_STATUS = 0 BEGIN

    --execute your sproc on each row
    exec DeleteComputer @ComputerID

    fetch next from cur into @ComputerID
END

close cur
deallocate cur

UPDATE NetworkDevice SET 
ComputerID = [DuplicateList].ComputerID
FROM [DuplicateList]
JOIN NetworkDevice ON [DuplicateList].ComputerFQDN = NetworkDevice.DNSFullName
where [DuplicateList].Recommendation = 'Keep inventory'



