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 > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > sql result to csv or excel file

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-22-07, 01:11
tiger66 tiger66 is offline
Registered User
 
Join Date: Dec 2007
Posts: 32
sql result to csv or excel file

Hi
I need some help from an expert in sybase and shell script.
Does anyone know how to save the data from a sql to a csv or excel file using shell script?

I can only save the data to a txt file. The problem is that the data in the file are not very readable. So, I want to save the data in a csv or excel file

the shell script I have is:

sql_file="sqls.sql"
output="out.txt"
`isql -U ${USER} -P ${PWD} -D ${DB} -S ${SEVER} -i $sql_file -o $output`

If you can help, please let me know. I will be really appreciated

Thanks
Reply With Quote
  #2 (permalink)  
Old 12-28-07, 15:56
PMASchmed PMASchmed is offline
Registered User
 
Join Date: Jun 2004
Location: Long Island
Posts: 696
We need to know what the contents are of sqls.sql, this is the important part.

I imagine it would be select col1 + ',' + col2 + ',' + col2 + ',' or something of this nature.
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