Similar to COPY FROM is there anything available for COPY TO


I was looking to create a CSV file of table output. I see multiple examples which can be executed along with vsql. However, I was looking for something similarly we use during COPY FROM command -
COPY myschema.my_table FROM LOCAL '/home/my_data.csv' DELIMITER E',' ABORT ON ERROR DIRECT;

I can execute this either from vsql command prompt or even other tools like DBVisualizer and read the external file "my_data.csv"
Similarly, is there a way to transfer the output of a select to a CSV file directly ?
Please do not mention about -
vsql -U dbadmin -w <> -F $',' -At -o tab_out.csv -c "SELECT * FROM my_schema.my_table;"

This can be executed from Linux command prompt. What I am looking for is to execute from vsql command prompt directly.



Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file