Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2007
    Posts
    32

    Unanswered: 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

  2. #2
    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.

Posting Permissions

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