export postgres table to csv how to
I have a table in postgres database. I want to export the records inside with headings of the table as CSV - Comma Seperated Values from Postgres. How can I achieve this ?
A Solution is available here.
http://stackoverflow.com/questions/1120109/export-postgres-table-to-csv-file-with-headings
http://stackoverflow.com/questions/1517635/save-pl-pgsql-output-from-postgresql-to-a-csv-file
Run this query in psql or pgadmin3
I have a table in postgres database. I want to export the records inside with headings of the table as CSV - Comma Seperated Values from Postgres. How can I achieve this ?
A Solution is available here.
http://stackoverflow.com/questions/1120109/export-postgres-table-to-csv-file-with-headings
http://stackoverflow.com/questions/1517635/save-pl-pgsql-output-from-postgresql-to-a-csv-file
Run this query in psql or pgadmin3
COPY products_273 TO '/tmp/products_199.csv' DELIMITER ',' CSV HEADER;
(or)
Copy (select * From userdetails) To '/tmp/test.csv' With CSV;
Where,
products_273 corresponds to the name of the table
'/tmp/products_199.csv' corresponds to the CSV file where the data is stored.
No comments:
Post a Comment