简体   繁体   中英

monetdb: export query result

How to export monetdb query result (eg to csv file)?

Manual says:

Copy into File

The COPY INTO command with a file name argument allows for fast dumping of a result set into an ASCII file. The file must be accessible by the server and a full path name may be required. The file STDOUT can be used to direct the result to the primary output channel.

The delimiters and NULL AS arguments provide control over the layout required.

COPY subquery INTO file_name [ [USING] DELIMITERS field_separator [',' record_separator [ ',' string_quote ]]] [ NULL AS null_string ]

https://www.monetdb.org/Documentation/Manuals/SQLreference/CopyInto

I'm trying with various syntax but with no result.

example query:

select * from test;

example failures:

copy select * from test into test.csv;
copy "select * from test" into test.csv;

OK. Missing apostrophe and full path. Also delimiters useful

copy select * from test into '/home/user/test.csv' using delimiters ',';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM