Skip site navigation (1) Skip section navigation (2)

Re: create database from text file, to delete columns

From: "Sean Davis" <sdavis2(at)mail(dot)nih(dot)gov>
To: e-letter <inpost(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: create database from text file, to delete columns
Date: 2008-04-02 15:02:13
Message-ID: 264855a00804020802g499b9074n213b24fd1c7f2fce@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
On Wed, Apr 2, 2008 at 10:56 AM, e-letter <inpost(at)gmail(dot)com> wrote:
> Readers,
>
>  I am using a program that saves data in csv format. I have realised
>  that I cannot view the file in my spreadsheet due to 256 column limit.
>
>  I think that I need to import the file into a database. Then I want to
>  review, then delete columns with null data.
>
>  I guess I can use the 'copy from' command? Also I do not know the
>  total number of columns so can I import into an empty database and the
>  columns are automatically created from the end of each line?

No.  You can easily use python, perl, R, java, or some other language
to parse the file and generate the create table statements.  However,
if you just need to remove some columns, you do not really need the
database at all.  Just use a little script (again, in a scripting
language) to remove the columns you like.

Sean

In response to

Responses

pgsql-novice by date

Next:From: e-letterDate: 2008-04-03 12:52:55
Subject: Re: create database from text file, to delete columns
Previous:From: e-letterDate: 2008-04-02 14:56:24
Subject: create database from text file, to delete columns

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group