Re: CSV file - Using COPY Command - Double-Quotes

From: "Daniel T(dot) Staal" <DStaal(at)usa(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: CSV file - Using COPY Command - Double-Quotes
Date: 2005-12-06 21:23:37
Message-ID: 59870.63.172.115.138.1133904217.squirrel@MageHandbook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Tue, December 6, 2005 12:01 pm, Walter said:

> All of the values within the CSV are surrounded with quotation marks. So
> a null value for a field looks like ""
>
> I am trying to import the file and no matter what I do, it hits a null
> date field and says
>
> invalid input syntax for type date : ""

sed 's/,"",/,,/g' filename > filename.new

Should do the trick...

(That is: Replace ever occurance of ,"", with ,, in the file 'filename'
and place the result in 'filename.new'. If you aren't on a Unix machine,
you may have to find another tool to do the same.)

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author. Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes. This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Mike Ellsworth 2005-12-06 22:19:51 Re: CSV file - Using COPY Command - Double-Quotes
Previous Message operationsengineer1 2005-12-06 21:16:50 Re: CSV file - Using COPY Command - Double-Quotes