I'm trying to download the select output query as a csv file into my local machine, from the server where the database is stored. I tried using the \copy command :
\copy (SELECT COUNT(*) FROM table) to 'C:\Folder\temp.csv' With CSV DELIMITER ',' HEADER;
It gives output COPY 1 in the terminal, but doesn't generate any csv file in the location. Would really appreciate any help, thanks !
'C:\Folder\temp.csv`` should be'C:\Folder\temp.csv'. This command(withchanged to ') worked for me on a Linux machine, in that I gotCOPY 1and atemp.csvfile was created. Do you have correct permissions on that directory? Also try it with'C:/Folder/temp.csv'.C:/Folder/temp.csvit says "No such file or directory".