How to export the resulting data in PostgreSQL to .CSV?

后端 未结 3 1827
离开以前
离开以前 2020-12-16 23:40

I use PostgreSQL 9.4.1

My query:

copy(select * from city) to \'C:\\\\temp\\\\city.csv\'
copy(select * from city) to E\'C:\\\\temp\\\\city.csv\'
         


        
3条回答
  •  猫巷女王i
    2020-12-17 00:07

    It could be late but i think it can be helpful.

    1. On Windows, make sure the output directory has gain the read/write right for Everyone (or you can specific user name).
    2. Using slash(/) instead of backslash(), example

    COPY DT1111 TO 'D:/TEST/DT1111_POST.CSV' DELIMITER ',' CSV HEADER;

提交回复
热议问题