Re: Importing complete txt file with column names

From: Josh Jore <josh(at)lavendergreens(dot)org>
To: robert kraus <rob_kra(at)yahoo(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Importing complete txt file with column names
Date: 2002-07-03 12:48:51
Message-ID: Pine.BSO.4.44.0207030744500.30576-100000@kitten.greentechnologist.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

This is where you grab your trusty language of choice (scripting most
likely) and write a one-off to take input like:

attr\tattr0\tattr1....
0\t1\t2\t.....

and turn it into

CREATE TABLE ... (
attr ....?,
attr0 ....?,
attr1 ....?
.....
);
COPY ....
0\t1\t2\t....

This isn't a hard problem but since there are specific thing where the
column types aren't known in advance there isn't any prebuilt tool for
this. Mostly you get to write it yourself. It's short - just do it.

Joshua b. Jore ; http://www.greentechnologist.org

On Tue, 2 Jul 2002, robert kraus wrote:

> hi,
>
> I have multiple huge tab delimited txt files with >500
> columns which I want to import, The name of the
> columns is important, has to be the name of the column
> in the table and is always very long. The copy command
> seems to work only with predefined tables. How do I
> import the tables with column names ?
>
> thank you very much for your answer
> robert

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Josh Jore 2002-07-03 13:10:54 Re: sequences what does ::text mean ?
Previous Message Andrew McMillan 2002-07-03 10:58:14 Re: sequences what does ::text mean ?