Re: CSV files & empty strings - Mailing list pgsql-general

From Raymond O'Donnell
Subject Re: CSV files & empty strings
Date
Msg-id 4ADDC601.8070200@iol.ie
Whole thread Raw
In response to CSV files & empty strings  (Nate Randall <nate1604@gmail.com>)
Responses Re: CSV files & empty strings
List pgsql-general
On 20/10/2009 05:55, Nate Randall wrote:
> I am new to Postgre, having formerly used Filemaker Pro.  I need to
> import CSV files into Postgre which contain some empty string "" values
> in several date-type fields.  I am able to import the CSV files into
> Postgre with the COPY FROM command if the datefields are converted to
> text fields in Postgre.  However, I need some method of "converting" the
> empty string "" values into NULL values after import, so that I can
> change the date fields back to date-type.  Any suggestions on how this
> could be accomplished?

How about:

  update <table> set <column> = null where <column> = '';

?


Ray.

pgsql-general by date:

Previous
From: Nate Randall
Date:
Subject: CSV files & empty strings
Next
From: David Fetter
Date:
Subject: Re: [sfpug] 10/13 SFPUG meeting, "The Mighty GUCS," video now available