Re: Exporting postgres query to CSV - Mailing list pgsql-general

From SCassidy@overlandstorage.com
Subject Re: Exporting postgres query to CSV
Date
Msg-id OFE0CA6758.2E60DA2F-ON88257169.0059E9BA-88257169.005A1042@overlandstorage.com
Whole thread Raw
In response to Exporting postgres query to CSV  (Ryan Suarez <ryan.suarez@sheridanc.on.ca>)
Responses Re: Exporting postgres query to CSV
List pgsql-general
A word of advice: if there is any chance that a column (e.g. text) contains
an embedded newline, you will be much better off outputting the data in
simple xml, instead of CSV.  This works very well with Excel for import.  I
just did a simple program for this recently.

Susan



                  
                           Ryan Suarez
                  
                      <ryan.suarez@sheridanc.        To:       pgsql-general@postgresql.org
                  
                      on.ca>                         cc:
                  
                           Sent by:                  Subject:  [GENERAL] Exporting postgres query to CSV
                  

                  
                                                      |-------------------|
                  
                      pgsql-general-owner@pos         | [ ] Expand Groups |
                  
                      tgresql.org                     |-------------------|
                  

                  

                  
                           05/09/2006 07:58
                  
                      AM
                  

                  

                  




Greetings,

I am running postgres 7.4.7 on debian sarge.

I need to run an SQL query and store the results in a file.  The format
needs to be comma separated values (CSV), so I can import this later in
Excel.

Any ideas on how to accomplish this?

much appreciated,
Ryan


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend





----------------------------------------------------------------------------------------------
Simply protected storage solutions ensure that your information is
automatically safe, readily available and always there, visit us at http://www.overlandstorage.com
----------------------------------------------------------------------------------------------


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_dump and grants to PUBLIC
Next
From: Blair Lowe
Date:
Subject: Re: pg_dump and grants to PUBLIC