title: BCP with input file
body: <p>I would like to export data with BCP</p>
  
  <p>Below is my command</p>
  
  <pre><code>bcp  queryout -i "test.sql" -o"myTable.csv" -S "server\Db" -E /c /t, -T
  </code></pre>
  
  <p><em>test.sql</em> has the SQL statemement. I need to keep the SQL in a file as the statement is rather long</p>
  
  <p>I have tested the SQL to be returning values in the management studio</p>
  
  <p>But I get the below errors in the command prompt</p>
  
  <blockquote>
    <p>Copy direction must be either 'in', 'out' or 'format'.</p>
  </blockquote>
  
  <p>I have also tried the below variations without much luck </p>
  
  <pre><code>bcp  out -i "test.sql" -o"myTable.csv" -S "server\Db" -E /c /t, -T
  bcp  -i "test.sql" out -o"myTable.csv" -S "server\Db" -E /c /t, -T
  bcp  -i "test.sql" queryout -o"myTable.csv" -S "server\Db" -E /c /t, -T
  </code></pre>