Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Copy from .txt file. Which path in windows?

Author  Topic 

jeannot
Starting Member

2 Posts

Posted - 2009-07-08 : 04:27:05
Hello everyone,

I am working on postgred in a windows environment
I would like to copy a .txt file into my table. I am therefore using COPY FROM:

COPY test.wind FROM 'c:\wind.txt' ;


However the file path is not recognized,

WARNING: nonstandard use of escape in a string literal
LINE 1: COPY test.wind FROM 'c:\wind.txt' ;
^
HINT: Use the escape string syntax for escapes, e.g., E'\r\n'.
ERROR: could not open file "c:wind.txt" for reading: No such file or directory

********** Error **********

ERROR: could not open file "c:wind.txt" for reading: No such file or directory
SQL state: 58P01



What is wrong?
What is the default folder?

Can sql deal with space in the path name?

Thanks for the help

Jeannot



SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-07-08 : 04:30:11
Because the query is executed on the server and not at your local client machine, the path to the file is relative from the servers point of view.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

jeannot
Starting Member

2 Posts

Posted - 2009-07-08 : 04:58:22
OK thanks
Go to Top of Page
   

- Advertisement -