title: Teradata SQL export to csv
body: <p>Is there a way to run a Teradata SQL query and then export the data to an external file?</p>
  
  <p>For example, if I ran:</p>
  
  <pre><code>SELECT TOP 10
    *
  FROM
    mydb.mytable
  </code></pre>
  
  <p>Could I write this in such a way that it will export to a CSV?  Do I need to store my data in a temp table first and then do <code>CREATE EXTERNAL TABLE</code>?  Any ideas would be appreciated - I've been returning data to <code>R</code> and then exporting, but there's no need for the intermediate step in some jobs.</p>