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