title: Cursor and if - else if statement issue
body: <p>I try to do this,</p>
  
  <pre><code>DECLARE cursor CURSOR FOR SELECT col1, col2, col3 ... FROM t1 WHERE...
  OPEN cursor
  FETCH NEXT FROM cursor INTO @col1, @col2, @col3
  WHILE @@FETCH_STATUS = 0
      BEGIN   
         IF(@col1 = 1)
         BEGIN
            update u
            set u.col1=2
            from t1 u
            where ...
         END
         ELSE IF(@col1 &lt;&gt; 1)
         BEGIN
           update u
            set u.col1=3
            from t1 u
            where ...
         END
      FETCH NEXT FROM cursor INTO @col1, @col2, @col3
      END
  CLOSE cursor_sala_curso
  DEALLOCATE cursor_sala_curso    
  </code></pre>
  
  <p>The problem is, when IF(@col1 = 1) update a record, that record enter in ELSE IF condition too and update the record col1 to 3</p>
  
  <p>Suppose the result set of the cursor has 5 records, three records with col1 with a value of 1 and two records with col1 with a value of 2, the above code update t1 10 times, not 5.</p>
  
  <p>Why enter into two statements? </p>
  
  <p>The result set of cursor change if I update a row of the table?</p>
  
  <pre><code>col1  col2    initial result set of cursor
    1    10
    1    11
    1    12
    2    13
    2    13 
  
  col1  col2    final result set with above code
    3    10
    3    11
    3    12
    3    13
    3    13 
  
   col1  col2    expected result set with above code
    2    10
    2    11
    2    12
    3    13
    3    13 
  </code></pre>
  
  <p>Thanks for your time.</p>