title: SQL Server : export from file.sql to a flat file
body: <p>I am looking for assistance in performing an export of data via an SQL Server query into a flat file which is delimited by a <code>|</code> (pipe).<br>
  I have done this in Sybase SQL without problems using the <code>OUTPUT</code> function within my code:</p>
  
  <pre><code>SELECT ItemName
  FROM Products
  WHERE ItemName = 'Gizmo'
  ; OUTPUT TO Z:\Export.txt FORMAT ASCII DELIMITED BY '\xA6' 
  </code></pre>
  
  <p>Does SQL Server have such a function and if so, how it is used? </p>
  
  <p><strong>Update</strong></p>
  
  <p>I should have clarified this a bit more. I would like to execute this <code>file.sql</code> statement via a VB Script in order to make a manual process into an automated one. Any manual functions within SQL Server Management Studio will not work. <code>xp_cmdshell</code> is not an option either as the DBA will not allow it. </p>