Le 2012-05-14 à 13:31, adebarros a écrit : > 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?
Import to a temp table, fill in the default value, then copy to the final table, something like this: CREATE TEMPORARY TABLE salaries_import(LIKE (salaries) ); COPY salaries_import(town, supervisor, salary) FROM '...', WITH (format csv); INSERT salaries(town, country, supervisor, salary) SELECT town, 'County Name', supervisor, salary FROM salaries_import; Hope that helps! François Beausoleil