Re: Finding Errors in .csv Input Data

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: Finding Errors in .csv Input Data
Дата
Msg-id 4D654D91.4030401@joeconway.com
обсуждение исходный текст
Ответ на Re: Finding Errors in .csv Input Data  (Rich Shepard <rshepard@appl-ecosys.com>)
Список pgsql-general
On 02/23/2011 09:23 AM, Rich Shepard wrote:
> On Wed, 23 Feb 2011, David Johnston wrote:
>
>> Why can you not just import the CSV as generated by Access?
>
>   I don't want additional quotation marks on all text.

I haven't followed this thread too closely, so maybe I'm missing
something, but isn't this essentially what you need to do?

# cat /tmp/test.csv
1,"testing 123,456","hello world",42

create table testcsv(id int, f1 text, f2 text, f3 int);
copy testcsv from '/tmp/test.csv' with csv delimiter ',' quote '"';
select * from testcsv;
 id |       f1        |     f2      | f3
----+-----------------+-------------+----
  1 | testing 123,456 | hello world | 42
(1 row)

HTH,

Joe

--
Joe Conway
credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting, & 24x7 Support


Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: runner
Дата:
Сообщение: Re: Index names not consistent
Следующее
От: John R Pierce
Дата:
Сообщение: Re: Data types for IP address.