Skip site navigation (1) Skip section navigation (2)

How to import a csv

From: "Oliveiros Cristina" <oliveiros(dot)cristina(at)marktest(dot)pt>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: How to import a csv
Date: 2007-08-24 11:50:58
Message-ID: 007401c7e645$0940c4c0$ (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
Hi, I am trying to import a file into a table.

The file has the form 
integer, string
integer, string

Table has 5 columns, but I just need to fill the first two, the others can remain blank 

I've tried COPY table1 FROM 'C:\\file.txt'

But PGAdmin ||| complains 
with the following : 
ERROR: invalid input syntax for integer: " 319613 , Sapo  "
SQL state: 22P02

319613 , Sapo is the very first line of the file. 
It seems that it is trying to put the pair (integer, string) in the first column alone

How can I fix this?

Thanx in advance for your help



pgsql-novice by date

Next:From: Sean DavisDate: 2007-08-24 12:14:38
Subject: Re: How to import a csv
Previous:From: Tom LaneDate: 2007-08-24 01:34:22
Subject: Re: Truncate table

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group