Re: Importing into Postgres from a csv file

From: "Zorlac" <zorlac(at)planetibiz(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Importing into Postgres from a csv file
Date: 2000-08-30 20:56:40
Message-ID: cyer5.15829$pu4.1135151@typhoon.ne.mediaone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

You sure can...

put the file somewhere on your db server.. let's just say /tmp and the file
is called data.db

su - postgres
psql [dbname]
copy TABLE from '/tmp/data.db' using delimiters ',';

That'll do ya.. Make sure that the columns are in the right order too... :)

Here's the syntax for the copy command

COPY [ BINARY ] table [ WITH OIDS ]
FROM { 'filename' | stdin }
[ [USING] DELIMITERS 'delimiter' ]
[ WITH NULL AS 'null string' ]
COPY [ BINARY ] table [ WITH OIDS ]
TO { 'filename' | stdout }
[ [USING] DELIMITERS 'delimiter' ]
[ WITH NULL AS 'null string' ]

Jake <ccrasoro(at)home(dot)com> wrote in message
news:y%Vo5(dot)24467$eR5(dot)721567(at)news1(dot)rdc1(dot)on(dot)wave(dot)home(dot)com(dot)(dot)(dot)
> Does any one know if this is possible, and if so how?
>
>
> Jake
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2000-08-30 21:06:41 Re: Post install - error
Previous Message Zorlac 2000-08-30 20:51:54 Re: system catalog question