Search Postgresql Archives

Re: Copy command to handle view for my export requirement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



COMMAND: copy (select * from employee) to 'C:/emp.csv'
ERROR:  could not open file "C:/emp.csv" for writing: Permission denied
********** Error **********
ERROR: could not open file "C:/emp.csv" for writing: Permission denied
SQL state: 42501

COMMAND: \copy (select * from employee) to 'C:/emp.csv'
ERROR:  syntax error at or near "\"
LINE 1: \copy (select * from employee) to 'C:/emp.csv'
       ^
********** Error **********
ERROR: syntax error at or near "\"
SQL state: 42601

Please correct me where I am going wrong. FYI, I am running under the administrator accounts of both Windows Login and PostgreSQL.

 
Two things,
1. you need to have a proper permissions where the .csv file creating.
2. In windows you need to use as below
postgres=#\copy (select * from employee) to 'C:\\emp.sql' 
 
Regards,
Raghavendra
EnterpriseDB Corporation
Blog: http://raghavt.blogspot.com/

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux