PostgreSQL – PgSql – Write output to CSV Excel
Sometimes it doesn’t have to be that difficult :
With the following statement you are able to import your (postgres) sql statements (file.sql) and write the corresponding output to a csv file (output_file.csv)
The name of the psql database and the psql user is ‘ dbname ‘ and all the columns are divided by ‘ | ‘
psql -F\| -A -f file.sql -o output_file.csv -h localhost -U dbname
December 17, 2007 | Filed Under IT
Comments
One Response to “PostgreSQL – PgSql – Write output to CSV Excel”
Leave a Reply
Awesome! That was a real time saver.