Re: Importing a CSV file to a table on Postgres - Mailing list pgsql-novice

From A. Kretschmer
Subject Re: Importing a CSV file to a table on Postgres
Date
Msg-id 20070504122436.GB21884@a-kretschmer.de
Whole thread Raw
In response to Importing a CSV file to a table on Postgres  ("Oliveiros Cristina" <oliveiros.cristina@marktest.pt>)
Responses Re: Importing a CSV file to a table on Postgres  (Phillip Smith <phillip.smith@weatherbeeta.com.au>)
List pgsql-novice
am  Fri, dem 04.05.2007, um 12:48:24 +0100 mailte Oliveiros Cristina folgendes:
> Hello, list.
>
> I have a CSV file with two values/row and I would like to import it into a
> table who has two columns as well.
>
> Is there an easy and expedited way to do this with Postgres administration tool
> (PgAdmin)? I can do a program that parses the file and INSERTs the values on
> table, but I suspect that there is an easy way and that it is not worth the
> effort.

I'm not familiar with PGAdmin, but with console you can use a way like
this to insert the contents of a CSV-file into a database table on a
remote host:

cat <file.csv> | ssh <host> "psql -U <user> <database> -c 'copy <table> from stdin;'"



Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

pgsql-novice by date:

Previous
From: "Oliveiros Cristina"
Date:
Subject: Importing a CSV file to a table on Postgres
Next
From: Phillip Smith
Date:
Subject: Re: Importing a CSV file to a table on Postgres