Thread: csv files

csv files

From
Dennis Gearon
Date:
Any  major gotcha's besides only <lf> at the end of lines uploading a csv file
using copy? I plan on loading the columns into text columns and converting them
as I load them to other tables.

The first two lines look like:
---------------------------------

ZIPCode,ZIPCodeType,City,CityType,County,CountyFIPS,State,StateCode,StateFIPS,MSA,AreaCode,TimeZone,GMTOffset,DST,Latitude,Longitude
00501,U,Holtsville,D,Suffolk,36103,New
York,NY,36,5380,631,Eastern,-5,Y,40.8147,-73.0451


Re: csv files

From
Bruno Wolff III
Date:
On Wed, Apr 09, 2003 at 11:34:57 -0700,
  Dennis Gearon <gearond@cvc.net> wrote:
> Any  major gotcha's besides only <lf> at the end of lines uploading a csv
> file using copy? I plan on loading the columns into text columns and
> converting them as I load them to other tables.

If any of the data is quoted you will need to strip the quotes. tsv usually
is a bit safer because of that.

>
> The first two lines look like:
> ---------------------------------
>
ZIPCode,ZIPCodeType,City,CityType,County,CountyFIPS,State,StateCode,StateFIPS,MSA,AreaCode,TimeZone,GMTOffset,DST,Latitude,Longitude
> 00501,U,Holtsville,D,Suffolk,36103,New
> York,NY,36,5380,631,Eastern,-5,Y,40.8147,-73.0451
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster