From: | Craig Barnes <cjbarnes18(at)gmail(dot)com> |
---|---|
To: | avalon78 geek <avalon78(dot)gr(at)gmail(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: ERROR: invalid input syntax for integer: SQL state: 22P02 |
Date: | 2012-01-01 20:07:07 |
Message-ID: | CAH3ft_XZecH82bkvv+Qa7S-6fDm1uMVmM+XP2o9c24fRKg3U8Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Hi,
On 1 January 2012 14:01, avalon78 geek <avalon78(dot)gr(at)gmail(dot)com> wrote:
> hi guys,
> i am new to pgsql and i am facing a strange problem which i cannot
> solve.i want to import data from a txt file to the table cust
>
> the table is
> CREATE TABLE cust
> (
> custid integer NOT NULL,
> custOccupation varchar(30) NOT NULL,
> PRIMARY KEY(custid)
> }
>
> and the txt file contains
> 13;developer
> 22;sales manager
> etc
>
> i issue the following sql command
> COPY cust
> FROM 'C:\Program Files\PostgreSQL\9.1\customers.txt'
> WITH DELIMITER ';' ;
>
> and i get an error
> ERROR: invalid input syntax for integer: "13"
> SQL state: 22P02
>
> i would appreciate if you could help me
>
> best regards and a happy new year!:)
>
I have no experience using text mode but have you tried CSV Mode?
e.g.
COPY cust
FROM 'C:\Program Files\PostgreSQL\9.1\
>
> customers.txt'
> WITH DELIMITER ';' CSV ;
HTH, happy new year.
--
Craig
() ascii ribbon campaign - against html mail
/\
From | Date | Subject | |
---|---|---|---|
Next Message | Jean-Yves F. Barbier | 2012-01-02 15:06:26 | error tryiing to insert with collate |
Previous Message | Tom Lane | 2012-01-01 18:08:06 | Re: ERROR: invalid input syntax for integer: SQL state: 22P02 |