title: Import multiline SQL query to single string
body: <p>In <a href="http://en.wikipedia.org/wiki/R_language" rel="noreferrer">R</a>, how can I import the contents of a multiline text file (containing SQL) to a single string? </p>
  
  <p>The sql.txt file looks like this:</p>
  
  <pre><code>SELECT TOP 100 
   setpoint, 
   tph 
  FROM rates
  </code></pre>
  
  <p>I need to import that text file into an R string such that it looks like this:</p>
  
  <pre><code>&gt; sqlString
  [1] "SELECT TOP 100 setpoint, tph FROM rates"
  </code></pre>
  
  <p>That's so that I can feed it to the RODBC like this</p>
  
  <pre><code>&gt; library(RODBC)
  &gt; myconn&lt;-odbcConnect("RPM")
  &gt; results&lt;-sqlQuery(myconn,sqlString)
  </code></pre>
  
  <p>I've tried the readLines command as follows but it doesn't give the string format that RODBC needs.</p>
  
  <pre><code>&gt; filecon&lt;-file("sql.txt","r")
  &gt; sqlString&lt;-readLines(filecon, warn=FALSE)
  &gt; sqlString
  [1] "SELECT TOP 100 "                              "\t[Reclaim Setpoint Mean (tph)] as setpoint, "
  [3] "\t[Reclaim Rate Mean (tph)] as tphmean "       "FROM [Dampier_RC1P].[dbo].[Rates]"           
  &gt; 
  </code></pre>