Thread: simple COPY FROM issue

simple COPY FROM issue

From
"Kevin Duffy"
Date:

Hello All:

 

I am attempting to import data from a CSV file.

 

The command I am using is as follows:

    copy imagineoptions   from 'C:\\Options20081112.csv'   DELIMITERS  ','  CSV ;

 

I get the following:

    WARNING:  nonstandard use of \\ in a string literal

     LINE 1: copy imagineoptions   from 'C:\\Options20081112.csv'   DELIM...

                                   ^

    HINT:  Use the escape string syntax for backslashes, e.g., E'\\'.

 

    ERROR: could not open file "C:\Options20081112.csv" for reading: No such file or directory

    SQL state: 58P01

 

If I run DIR at the command prompt I get:

 

C:\>dir C:\Options20081112.csv

 Volume in drive C has no label.

 Volume Serial Number is 1824-0333

 

 Directory of C:\

 

11/12/2008  04:04 PM         1,300,220 Options20081112.csv

               1 File(s)      1,300,220 bytes

               0 Dir(s)  40,459,689,984 bytes free

 

C:\>

 

I have tried many variations of slashes and back-slashes, but nothing works.

I am working within pgAdmin under Windows XP.

 

Please help me preserve my sanity.  I do not see that I am doing wrong.

But I am certain it is very simple.

 

Best Regards

 

 

Kevin Duffy

 

Re: simple COPY FROM issue

From
brian
Date:
 > HINT:  Use the escape string syntax for backslashes, e.g., E'\\'.

Try:

COPY imagineoptions FROM E'C:\\Options20081112.csv' ...

or:

COPY imagineoptions FROM 'C:/Options20081112.csv' ...


Kevin Duffy wrote:
> Hello All:
>
>
>
> I am attempting to import data from a CSV file.
>
>
>
> The command I am using is as follows:
>
>     copy imagineoptions   from 'C:\\Options20081112.csv'   DELIMITERS
> ','  CSV ;
>
>
>
> I get the following:
>
>     WARNING:  nonstandard use of \\ in a string literal
>
>      LINE 1: copy imagineoptions   from 'C:\\Options20081112.csv'
> DELIM...
>
>                                    ^
>
>     HINT:  Use the escape string syntax for backslashes, e.g., E'\\'.
>
>
>
>     ERROR: could not open file "C:\Options20081112.csv" for reading: No
> such file or directory
>
>     SQL state: 58P01
>
>
>
> If I run DIR at the command prompt I get:
>
>
>
> C:\>dir C:\Options20081112.csv
>
>  Volume in drive C has no label.
>
>  Volume Serial Number is 1824-0333
>
>
>
>  Directory of C:\
>
>
>
> 11/12/2008  04:04 PM         1,300,220 Options20081112.csv
>
>                1 File(s)      1,300,220 bytes
>
>                0 Dir(s)  40,459,689,984 bytes free
>
>
>
> C:\>
>
>
>
> I have tried many variations of slashes and back-slashes, but nothing
> works.
>
> I am working within pgAdmin under Windows XP.
>
>
>
> Please help me preserve my sanity.  I do not see that I am doing wrong.
>
> But I am certain it is very simple.
>
>
>
> Best Regards
>
>
>
>
>
> Kevin Duffy
>
>
>
>