title: Update multiple columns of a table in SQL Server using R
body: <p>This is <code>table1</code> in SQL Server:</p>
  
  <pre><code>Last   Country   colA   colB   colC
  ------------------------------------
  1      ARG       NA     NA     NA
  2      NULL      NA     NA     NA
  3      CAM       NA     NA     NA
  4      NULL      NA     NA     NA
  5      NULL      NA     NA     NA
  </code></pre>
  
  <p>This is my dataframe <code>DF</code> in R:</p>
  
  <pre><code>colA   colB   colc
  20     foo    1.2
  12     bar    12.2
  1      tam    10.3
  15     red    0.8
  </code></pre>
  
  <p>Now how do I iterate for every row in <code>DF</code> so that it could be updated in <code>table1</code>?</p>
  
  <p>This is the code in r</p>
  
  <pre><code>conn &lt;- odbcDriverConnect('DRIVER={SQL Server};SERVER=dusty;DATABASE=Area;UID=admin;PWD=abcd@123;autocommit=True')
  data &lt;- sqlQuery(conn,paste("select * from table1;"))
  for(i in 1:length(DF)) {
  update.query &lt;- paste("UPDATE table1 ", 
                         "SET colA=?",
                         "SET colB=?",
                         "SET colC=?",
                         "WHERE Country is NULL", sep="")
  dummy &lt;- sqlQuery(conn, update.query)
  }
  </code></pre>
  
  <p>Any suggestions how it could be done?</p>
  
  <p>Thanks.</p>