Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2007
    Posts
    7

    isql "sp_" output formatting and spool file

    Hi Sybase Experts,

    Is there any command in Sybase similar to "spool file.lst" in Oracle sqlplus ?
    "isql -o" in Sybase cannot turn spooling to file on and off interactively.

    Is there any method to limit the width of each field from the output of "sp_" stored proc in isql ? And can I just choose one of the fields to display ? The output of "sp_" stored proc is difficult to see from dump terminal.


  2. #2
    Join Date
    Mar 2007
    Posts
    72
    Hi Tiffany,
    When you start a isql session try using -w1000 for the width, this will give you a formatting of the results. If you want the similar functionality of spool, open a text editior and give sp_xxx and go in the next line and save this file as say x.sql.

    isql -Usa -Sserver -ix.sql -ooutput.log

    hope this helps

  3. #3
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,353
    Maybe use sqsh (www.sqsh.org) as your client. In sqsh, you
    can redirect query results to a file as follows:

    1> select * from mytable ; > my_output_file.txt

    Note that the semicolon is just a terminator command for the client and not
    (like PL/SQL) part of the SQL language. The '>' sign does the output
    redirect.

  4. #4
    Join Date
    Aug 2007
    Posts
    59
    Hi
    use sql advantage
    u will get all the answers in it.
    copy it and paste to notepad

  5. #5
    Join Date
    Mar 2007
    Posts
    167

    "limit the width of each field"

    Tiffany,

    You wrote the following...

    --------------------------------------------------------------------------------

    Q01) "Is there any command in Sybase similar to "spool file.lst" in Oracle sqlplus?"

    A01) Unfortunately, the answere is no. Functionality does not exist. You will have to find a third party tool to achieve the same functionality. Or, use something of the like... create a shell / perl script that similates this functionality.

    ----------------------------------------

    Q02) "Is there any method to limit the width of each field from the output of "sp_" stored proc in isql"

    A02) Unfortunately, the answer is no... Functionality does not exist. (via isql). I've researched this quetion myself several months ago and never found a way via isql. The alternative is to use a third party tool. I have not tested this myself, but believe you can achieve this by using SQSH (similar to isql). SQSH is a free utility that you can find at www.SQSH.org.

    ----------------------------------------

    Q03) "And can I just choose one of the fields to display ? The output of "sp_" stored proc is difficult to see from dump terminal."

    A03) Unfortunately, the answer to the first part of your question is no. You will need to create custom procedures to achieve this. Please look at the below URL for good examples...

    http://www.edbarlow.com/gem/procs_only/index.htm

    We use Ed's stored procedurese to achive the custom functionality you are looking to achieve.


    The second part of your question / statement...

    As sudarao recommended, using the -w 1000 will help make the output more human readable (i.e. isql -Usa -Sserver -w 1000). You can of course use a smaller or larger number that fits your needs.

    --------------------------------------------------------------------------------

    Hope the above information is helpful.

  6. #6
    Join Date
    Jul 2007
    Posts
    7
    Thank you very much Sudarao, Pdreyer, Niranjan and Ftmjr !!!!

Posting Permissions

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