Re: Table column headings PgAmin4

From: "Ted Jones" <ted(at)mentra(dot)co(dot)uk>
To: "Murtuza Zabuawala" <murtuza(dot)zabuawala(at)enterprisedb(dot)com>
Cc: "pgAdmin Support" <pgadmin-support(at)postgresql(dot)org>
Subject: Re: Table column headings PgAmin4
Date: 2018-02-07 18:01:59
Message-ID: 0C3B5ABC0B1D4F9A997AE3CF96F1B8E7@CARON
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

Hi Murtuza

Thank you for your reply. Unfortunately it is not practical to use this approach when there may be 100s of columns! I will look at pgfutter.

regards

Ted Jones
----- Original Message -----
From: Murtuza Zabuawala
To: TedJones
Cc: pgAdmin Support
Sent: Wednesday, February 07, 2018 5:33 PM
Subject: Re: Table column headings PgAmin4

You can use builtin COPY tool to load the CSV data into the table but the destination table must be present before you load CSV.

COPY your_table(column_1, column_2, column_3...column_N)

FROM 'C:\tmp\mydata.csv' DELIMITER ',' CSV HEADER;

If you wish then you can try third party tool called pgfutter.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Wed, Feb 7, 2018 at 8:18 PM, TedJones <ted(at)mentra(dot)co(dot)uk> wrote:

I am quite new to PostgreSQL and I am having difficulty with the following:

I am trying to input a csv file into a table that has a very large number of
columns. This means that it is impractical to create a table and specify the
name of all the columns. Can the column headings be taken from the first
line of the csv file?

Additionally, I have tried to do this with smaller number of columns with
CREATE table but the column headings appear in a different order to what is
in the csv file (that cannot be edited). I then cannot edit (cut and paste
as you would expect!) the SQL to change the order of the columns. Surely
there must be a way of doing this!! I have no control over the input csv
files that contain the data.

--
Sent from: http://www.postgresql-archive.org/PostgreSQL-pgadmin-support-f2191615.html

In response to

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message David G. Johnston 2018-02-07 18:28:45 Re: Table column headings PgAmin4
Previous Message Murtuza Zabuawala 2018-02-07 17:33:33 Re: Table column headings PgAmin4