From: | adebarros <adebarros(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | COPY from CSV, passing in default value? |
Date: | 2012-05-14 17:31:03 |
Message-ID: | 1337016663146-5708672.post@n5.nabble.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Assuming I have a table structured like so:
CREATE TABLE salaries (
Town varchar(30),
County varchar(30),
Supervisor varchar(30),
StartDate date,
Salary int,
Benefits int
);
If I have a CSV with only three of those fields, I can import like this:
COPY salaries (Town, Supervisor, Salary)
FROM 'C:\salaries.csv'
WITH (FORMAT CSV);
However, what if I wanted to assign a default value during import to
populate the County field? In my dreams it would be something like this
(which does not work):
COPY salaries (Town, 'County Name', Supervisor, Salary)
FROM 'C:\salaries.csv'
WITH (FORMAT CSV);
Any ideas?
Thanks.
--
View this message in context: http://postgresql.1045698.n5.nabble.com/COPY-from-CSV-passing-in-default-value-tp5708672.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
From | Date | Subject | |
---|---|---|---|
Next Message | EllyR | 2012-05-14 17:58:42 | Re: Move the postgreSQL database from Drive C to Map Network Drive (Called Z) |
Previous Message | Paulo Correia | 2012-05-14 16:28:07 | Re: Postgres 9.0 Streaming Replication and Load Balancing? |