title: How to insert a dataframe into a SQL Server table?
body: <p>I'm trying to upload a dataframe to a SQL Server table, I tried breaking it down to a simple SQL query string..</p>
  
  <pre><code>library(RODBC)
  con &lt;- odbcDriverConnect("driver=SQL Server; server=database")
  
  df &lt;- data.frame(a=1:10, b=10:1, c=11:20)
  
  values &lt;- paste("(",df$a,",", df$b,",",df$c,")", sep="", collapse=",")
  
  cmd &lt;- paste("insert into MyTable values ", values)
  
  result &lt;- sqlQuery(con, cmd, as.is=TRUE)
  </code></pre>
  
  <p>..which seems to work but does not scale very well. Is there an easier way?</p>