Re: access database conversion - Mailing list pgsql-general

From Björn Lundin
Subject Re: access database conversion
Date
Msg-id 20020220222742.3528c9ac.bjorn.lundin@swipnet.se
Whole thread Raw
In response to access database conversion  (Hugo Coolens <hugo.coolens@skynet.be>)
List pgsql-general
On Wed, 20 Feb 2002 20:36:44 +0100
Hugo Coolens <hugo.coolens@skynet.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

pgsql-general by date:

Previous
From: Hugo Coolens
Date:
Subject: tutorial, missing file
Next
From: Hans-Juergen Schoenig
Date:
Subject: Re: number of connections to postmaster