Search Postgresql Archives

Re: Finding Errors in .csv Input Data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux