Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Postgre Sql Export query

Posted on 2008-10-06
4
Medium Priority
?
906 Views
Last Modified: 2012-05-05
  Is there any kind of query that i can use to export my data in postgresql that i select with special conditions ?

   If thereisnt something like that , i am currently using phpPgadmin is it possible to do it from there ?

   If not , than which 3 hd party tool should i use ?

  Notice : I am not talking about exporting data in a database or in a specific table , i need to export data which i can apply WHERE clause.
0
Comment
Question by:Ali Kayahan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
thewild earned 2000 total points
ID: 22650215
Yes, you can use PostgreSQL's COPY command do achieve that.

http://www.postgresql.org/docs/8.3/static/sql-copy.html

The file will be exported to a path relative to your SERVER installation. If your server is running under an account that has sufficient rights, it wan write to a network share.
COPY (SELECT * FROM mytable WHERE somecolumn = somevalue) TO E'C:\\myexportedfile.txt';

Open in new window

0
 
LVL 14

Author Comment

by:Ali Kayahan
ID: 22650376
Thanks thewild , i wonder if is it possible to export it as xls keeping the tabular data ?
0
 
LVL 4

Expert Comment

by:thewild
ID: 22650447
You can export it as CSV.
CSV is "Comma Separated Value", and it will open in Excel just fine (I even think that ".csv" files are associated to Excel whenever you install MS Office).
Just add "CSV" (without the quotes) at teh very end of your COPY command.
0
 
LVL 14

Author Comment

by:Ali Kayahan
ID: 22650494
Thanks
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many developers have database experience, but are new to PostgreSQL. It has some truly inspiring capabilities. I have several years' experience with Microsoft's SQL Server. When I began working with MySQL, I wanted a quick-reference to MySQL (htt…
By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question