Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2012

    Unanswered: isql with 'output to'


    I'm using Sybase 15 with ASA 11. I'm trying to output results of my stored procedure to an Excel file and calling this from a batch file to run regularly. Here's my code:

    runreport.sql :
    exec myprocedure
    output to 'd:\reports\myreport.xls' format html

    runreport.bat :
    isql -Ureportuser -Preportuser -Smyserver -id:\reports\runreport.sql

    If I run the sql file in the Interactive SQL GUI, it outputs the excel file perfectly. But when I run it using the command line isql, it throws me a "Syntax error near keyword 'output' " error message.

    I tried using the -o option in isql to output the results, but then I have to look at setting up Excel macros to convert this to xls. I would prefer to avoid this route especially since Sybase does seem to have this 'output to' option. Just how do you get it to work with command line isql though?

    Anyone got any ideas?


  2. #2
    Join Date
    Jan 2012
    Provided Answers: 1
    Hi there,

    Instead of using the "output to", try the "OUTPUT USING".

    Something like this may work:

    OUTPUT USING 'Driver=Microsoft Excel Driver (*.xls);DBQ='d:\\reports\\myreport.xls'
    INTO "myreport";

    This is a long shot.....

    Last edited by Catarrunas; 02-22-12 at 07:41.

  3. #3
    Join Date
    Feb 2012
    No luck. Still the same error.

    Msg 156, Level 15, State 2
    Incorrect syntax near the keyword 'output'

    Like I said, the 'output to' works in the GUI version of ISQL, just not in the command line version. 'output using' errored out in the GUI as well.
    Last edited by cspsp; 02-22-12 at 07:55.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts