access database conversion

Started by Hugo Coolensabout 24 years ago2 messagesgeneral
Jump to latest
#1Hugo Coolens
hugo.coolens@skynet.be

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

#2Björn Lundin
bjorn.lundin@swipnet.se
In reply to: Hugo Coolens (#1)
Re: access database conversion

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