DECLARE @No_Peserta VARCHAR(12)

DECLARE list_cursor CURSOR FOR  
SELECT
  No_Peserta
FROM
  dbo.Peserta
WHERE
  No_Proposal = '2015.0419' 
  AND Status = 'O'

OPEN list_cursor  
FETCH NEXT FROM list_cursor INTO @No_Peserta  

WHILE @@FETCH_STATUS = 0  
BEGIN  

       UPDATE Peserta SET Status='C' WHERE No_Proposal='2015.0419' AND No_Peserta = @No_Peserta AND Status='O'
       PRINT @No_Peserta

  FETCH NEXT FROM list_cursor INTO @No_Peserta  
END  

CLOSE list_cursor  
DEALLOCATE list_cursor 

