title: Write SQL query output into text file/log file
body: <p>How to write the output of SQL query to .txt file.
  Here is what I am trying to do.
  The SQL query is written inside a perl script. </p>
  
  <pre><code>use strict;
  use DataObject;
  
  # create new object, number of default values are set.
  my $obj = new DataObject();
  
  # set database server to connect
  $obj-&gt;SetDBIdent('someDB');
  
  # get fully qualified name
  my $bv = $obj-&gt;GetTbl("bv");
  
  # query string
  my $sql = qq[
      select TOP 100 bv.book_price from $bv bv
      where bv.book_yield is null
      OUTPUT INTO '\\logs.txt'        
  ];
  
  # Execute the query
  my $resultSet = $obj-&gt;DoSql($sql);
  
  # print the results
  foreach my $row (@$resultSet) {
      print "$row-&gt;{book_price}\t";
  </code></pre>
  
  <p>Here is the error I get-->
     Can't execute statement:</p>
  
  <pre><code>select TOP 100 bv.book_price from acctdb.dbo.bv bv
  where bv.book_yield is null
  OUTPUT INTO '\logs.txt'
  
   Transaction Rolled Back
  DBD::Sybase::st execute failed: Server message number=156 severity=15 state=2 line=4 server=SYBDEVtext=Incorrect syntax near the keyword 'OUTPUT'.
  Statement=
      select TOP 100 bv.book_price from  bv
      where bv.book_yield is null
      OUTPUT INTO '\logs.txt'
  </code></pre>