If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Sybase > isql "sp_" output formatting and spool file

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
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.

Reply With Quote
  #2 (permalink)  
Old
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
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.
Reply With Quote
  #4 (permalink)  
Old
Registered User
 
Join Date: Aug 2007
Posts: 59
Hi
use sql advantage
u will get all the answers in it.
copy it and paste to notepad
Reply With Quote
  #5 (permalink)  
Old
Registered User
 
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.
Reply With Quote
  #6 (permalink)  
Old
Registered User
 
Join Date: Jul 2007
Posts: 7
Thank you very much Sudarao, Pdreyer, Niranjan and Ftmjr !!!!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On