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

    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';

    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
    Provided Answers: 8
    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:

    Tips for good questions:

Posting Permissions

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