Re: using copy to insert data.

From: Andrew McMillan <andrew(at)catalyst(dot)net(dot)nz>
To: Jennifer Lee <jlee(at)scri(dot)sari(dot)ac(dot)uk>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: using copy to insert data.
Date: 2003-02-06 18:04:11
Message-ID: 1044554651.2940.11.camel@kant.mcmillan.net.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Fri, 2003-02-07 at 05:40, Jennifer Lee wrote:
> I'm trying to insert data from a delimited file using the copy command
> (COPY table FROM 'filepath') this works fine, but I would like to insert
> data into specific columns. I've read that this is possible but haven't
> been able to find documentation on how to do it. I've been able to
> insert the data as I'd like in two steps. 1. copy into a temporary table, 2.
> insert using select columns from the temporary table. Is there a way to
> do this in one step?

COPY table (column1, column2, column3 ) FROM ....

According to the docs it works in 7.3 but I have never had cause to use
that syntax myself.

Regards,
Andrew.
--
---------------------------------------------------------------------
Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St, Wellington
WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St
DDI: +64(4)916-7201 MOB: +64(21)635-694 OFFICE: +64(4)499-2267
Survey for nothing with http://survey.net.nz/
---------------------------------------------------------------------

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Steve Crawford 2003-02-06 18:59:08 Re: Favorite Linux Editor for PostgreSQL Scripts?
Previous Message Andrew McMillan 2003-02-06 18:01:39 Re: Html output