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

Really easy problem...

From: James David Smith <james(dot)david(dot)smith(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Really easy problem...
Date: 2012-08-02 11:12:11
Message-ID: CAMu32ABa_Tg3=bQRtN+JVhN+uzGAN2vkk25__vdyvqsivy8fRA@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
Hi everyone,

I'm struggling with something which I'm sure should be REALLY easy. But I
can't quite get it to work. I've got a CSV file with two columns which
looks like the below:

2012-07-15 10:00:00, 1
2012-07-15 10:00:00, 2
2012-07-15 10:00:00, 3
2012-07-15 10:00:00, 4
2012-07-15 10:00:00, 5

I want to copy the data into this table:

CREATE TABLE master_table_interpolated(
date_time TIMESTAMP WITH TIME ZONE,
person_id INTEGER,
person_location GEOMETRY);

So the data from the CSV file should go into the first two columns of my
table, and leave the final one blank. I use this query to pull the CSV file
in, however I can't figure out how to map the data to the correct columns
in my table.

COPY master_table_interpolated from 'C:/Program
Files/PostgreSQL/9.0/data/basetime.csv' DELIMITERS ',' CSV;

Ideas please?

Thanks

James

Responses

pgsql-novice by date

Next:From: Oliveiros d'Azevedo CristinaDate: 2012-08-02 11:26:01
Subject: Re: Really easy problem...
Previous:From: Achim Jansen, Promax VPMDate: 2012-08-02 10:49:14
Subject: Slow W7 64 ODBC connection

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