title: How to use cursor to update record
body: <p>i am using below query to update my all records but it starts update from second row 
  how can i modify it to do changes from 1'st row ?</p>
  
  <p>i am using <strong>mssql 2008</strong></p>
  
  <p>i think i can not use <code>@@FETCH_STATUS</code> as 1'st line as it is global.</p>
  
  <p>thanks in advance </p>
  
  <pre><code>use vivdb
  
  DECLARE @empno as int;
  select @empno = 10;
  
  DECLARE Employee_Cursor CURSOR FOR select * from emp
  OPEN Employee_Cursor;
  
  FETCH NEXT from Employee_Cursor
  
  WHILE @@FETCH_STATUS = 0
     BEGIN
  
        update emp set empno = @empno;
        select @empno = @empno+1;
  
       FETCH NEXT from Employee_Cursor
     END;
  
  CLOSE Employee_Cursor;
  DEALLOCATE Employee_Cursor;
  GO
  </code></pre>