title: loop update Cursor in sql server
body: <p>I want to update a table containing 2 million rows. I want to update three columns in that table for a particular item name which is from Table POII which contain 800 rows and 3 columns. </p>
  
  <p>I need to write a cursor for that in SQL Server 2014.</p>
  
  <p>How should I write it? It's giving a syntax error.</p>
  
  <p>The table with 2 million records is MNB</p>
  
  <pre><code>DECLARE cursor1 CURSOR FOR
      Select * from poii ;
  OPEN c1;
  
  
  Begin
  while i in cursor1 loop
  
  
  Update MNB set salesgroup=i.salesgroup, category= i.category ,subcategory =i.subcategory  where itemname = i.itemname;
  
  Commit; 
  </code></pre>