COPY from CSV, passing in default value?
| От | adebarros |
|---|---|
| Тема | COPY from CSV, passing in default value? |
| Дата | |
| Msg-id | 1337016663146-5708672.post@n5.nabble.com обсуждение исходный текст |
| Ответы |
Re: COPY from CSV, passing in default value?
Re: COPY from CSV, passing in default value? |
| Список | 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.
В списке pgsql-general по дате отправления: