Tuesday, 10 April 2012

Creating CSV file from postgres sql command


Hi,

Here is the command to create a CSV from postgres sql.
By running a single command you can get the CSV file with the specific select statement,

COPY (SELECT first_name,last_name FROM users) TO ‘/tmp/users.csv’ WITH CSV HEADER

Thank You,
Uma Mahesh.

No comments:

Post a Comment