Re: Populating a database

From: Nick Sayer <nsayer(at)quack(dot)kfu(dot)com>
To: papapep <papapep(at)gmx(dot)net>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Populating a database
Date: 2002-11-04 18:02:38
Message-ID: 3DC6B63E.3000602@kfu.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

papapep wrote:

> How can I populate a database with data I've got in a spreadsheet
> without having to format it with all the terrible format with commas,
> sql orders and so on??
> Or, at least, which is the easiest way to do it?

Probably the easiest way, if you're good with perl, is to save the
spreadsheet in a suitably helpful ASCII format (CSV or what not), then
write a custom perl script that uses the Pg module to import the data.

Alternatively, you could use perl (or anything else) to change the ASCII
format into a big COPY statement and use \i in psql to import it.

Last, but not least, if you've got Windows, you could use ODBC with an
ODBC->postgres driver, though the details escape me (and the perl option
is probably easier).

>
>
> Thanks in advance for your answer.
>
> Josep Sànchez
> [papapep]
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Josh Berkus 2002-11-04 18:12:56 Re: Populating a database
Previous Message Henshall, Stuart - Design & Print 2002-11-04 16:25:50 Re: moving a postgreSQL DB, etc.