Re: Importing a CSV file to a table on Postgres

Поиск
Список
Период
Сортировка
От A. Kretschmer
Тема Re: Importing a CSV file to a table on Postgres
Дата
Msg-id 20070504122436.GB21884@a-kretschmer.de
обсуждение исходный текст
Ответ на Importing a CSV file to a table on Postgres  ("Oliveiros Cristina" <oliveiros.cristina@marktest.pt>)
Ответы Re: Importing a CSV file to a table on Postgres  (Phillip Smith <phillip.smith@weatherbeeta.com.au>)
Список 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 по дате отправления:

Предыдущее
От: "Oliveiros Cristina"
Дата:
Сообщение: Importing a CSV file to a table on Postgres
Следующее
От: Phillip Smith
Дата:
Сообщение: Re: Importing a CSV file to a table on Postgres