Opperix Opperix - 1 year ago 318
SQL Question

Export vertica query result to csv file

I`m working with Vertica. I try to export data from SELECT query into csv. I try to make it with sql query:

SELECT * FROM table_name INTO OUTFILE '/tmp/fileName.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';


But get problem

[Vertica][VJDBC](4856) ERROR: Syntax error at or near "INTO"


Is there other way to import query result in csv file, do not want to use vsql, but if there no other way, I will use

vsql -c "select * from table_name;" > /tmp/export_data.txt.

Answer Source

You're using a syntax that's not valid for Vertica. Please read the documentation.

Vertica only supports exports locally.

The client your using needs to have support for a file export. For example, in Excel, you could set up the ODBC connection and import the data.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download