Re: How to import a CSV file (originally from Excel)

Поиск
Список
Период
Сортировка
Искать

Re: How to import a CSV file (originally from Excel)

От:
"Magnus Hagander" <mha@sollentuna.net>
Дата:
> > \copy "Flight Traffic" from yourfile.csv delimiter as ',' 
> csv quote as 
> > '"'
> > 
> > (might need some adaption, of course)
> > 
> > 
> > Loading 45,000 lines is trivial for copy, it shouldn't take 
> noticable 
> > time at all.
> ----
> along these lines - can I do something similar (CSV file) but 
> 'update' 2 or 3 columns?

I'd use COPY to a temp table, then run a normal UPDATE on that.

//Magnus

Re: How to import a CSV file (originally from Excel)

От:
Craig White <craigwhite@azapple.com>
Дата:
On Wed, 2006-04-12 at 17:57 +0200, Magnus Hagander wrote:
> > > \copy "Flight Traffic" from yourfile.csv delimiter as ',' 
> > csv quote as 
> > > '"'
> > > 
> > > (might need some adaption, of course)
> > > 
> > > 
> > > Loading 45,000 lines is trivial for copy, it shouldn't take 
> > noticable 
> > > time at all.
> > ----
> > along these lines - can I do something similar (CSV file) but 
> > 'update' 2 or 3 columns?
> 
> I'd use COPY to a temp table, then run a normal UPDATE on that.
----
is that a pg 8.x thing? I'm using 7.4.x (RHEL)

th-db_development=# \copy "clients_temp" from representatives.csv
delimiter as ',' csv quote as '"'
ERROR:  syntax error at or near "CSV" at character 53
LINE 1: ...PY "clients_temp" FROM STDIN USING DELIMITERS ',' CSV
QUOTE ...
                                                             ^
\copy: ERROR:  syntax error at or near "CSV" at character 53

Craig

FAQ