Re: [despammed] CSV Import?

Поиск
Список
Период
Сортировка
От Andreas Kretschmer
Тема Re: [despammed] CSV Import?
Дата
Msg-id 20050715075213.GA23924@webserv.wug-glas.de
обсуждение исходный текст
Ответ на CSV Import?  (Lucius Seneca <peter.weinzierl@gmail.com>)
Ответы Re: [despammed] CSV Import?  (Lucius Seneca <lucius.seneca@gmail.com>)
Список pgsql-novice
am  10.07.2005, um 17:00:06 +0200 mailte Lucius Seneca folgendes:
> Hi,
>
> does anybody know whether I could use any sign for CSV-Import into PGSQL or
> does it have to
> be a comma? Problem is that I got a couple of datasets which have that
> character included and I can't change them, also inverted commas are used,
> thus CSV-Import.

You can use   \copy   from psql.


kretschmer@kaufbach:~$ cat csv.sql
1,3,5
4,2,8
kretschmer@kaufbach:~$ psql test
Welcome to psql 8.0.3, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

test=> delete from csv_import ;
DELETE 2
test=> \copy csv_import from 'csv.sql' delimiter ','
\.
test=> select * from csv_import;
 a | b | c
---+---+---
 1 | 3 | 5
 4 | 2 | 8
(2 rows)


Regards, Andreas
--
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47212,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===    Schollglas Unternehmensgruppe    ===

В списке pgsql-novice по дате отправления:

Предыдущее
От: John DeSoi
Дата:
Сообщение: Re: Using Batch Files to Create DB Structure
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: Backups