Re: access database conversion

From: Bjrn Lundin <bjorn(dot)lundin(at)swipnet(dot)se>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: access database conversion
Date: 2002-02-20 21:27:42
Message-ID: 20020220222742.3528c9ac.bjorn.lundin@swipnet.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 20 Feb 2002 20:36:44 +0100
Hugo Coolens <hugo(dot)coolens(at)skynet(dot)be> wrote:

> I have exported an access database in csv-format with the first line the
> names of the attributes. I now want to make a postgresql database from
> this, what's the most efficient way to follow?
>
> hugo
>

bnl=# \h copy
Command: COPY
Description: Copies data between files and tables
Syntax:
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' ]

example
copy mytable from '/tmp/myfile' using delimiters ';' with null as 'whatever_you_have_for_null_if_any'

Remove the headings from the file first, andmake sure Mytable matches the fields in Myfile

regards
Björn

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Charles Albrecht 2002-02-20 21:28:36 Re: Ordering 'A', 'B', ..., 'Z', 'AA', 'AB', ...
Previous Message Dean Hill 2002-02-20 21:22:40 Re: documention on psql?