Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

export psql result to csv

-- Client side -This approach does the file handling on the client side
Copy (Select * From foo) To '/tmp/test.csv' With CSV DELIMITER ',' HEADER

-- Server side - This approach runs entirely on the remote server
Copy (Select * From foo) To '/tmp/test.csv' With CSV DELIMITER ',' HEADER;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #export #psql #result #csv
ADD COMMENT
Topic
Name
8+7 =