Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2012
    Posts
    1

    Question Unanswered: Unable to get data in proper excel format after sql query execution

    Hi All,
    I am new to sql. I want to get some data from tables in proper excel format. I have tried to execute below query and successfully provides the data but not in proper column-row format..
    >psql ctrlm700
    psql>\o '/home4/fmldev222/contrlm7/ACCUTRATE.csv'
    psql>Select jobname,schedtab,daystr,wdaystr,monthstr,ajfsonstr ,conf,dayscal,weekcal,confcal,shift,changedatetime from CMS_JOBDEF where SCHEDTAB = 'BPIS_DEV';
    psql>\q

    Kindly suggest what attributes of syntax do I need to put so the data would be in proper format.

  2. #2
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    To generate CSV files COPY is the better alternative.

    Or if you need the file on your client machine, use psql's \copy command
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags: http://www.dbforums.com/misc.php?do=bbcode#code

    Tips for good questions:

    http://tkyte.blogspot.de/2005/06/how...questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

Posting Permissions

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