View Single Post

   
  #8 (permalink)  
Old 02-28-2008, 10:20 AM
Peter H. Coffin
 
Posts: n/a
Default Re: Importing from non-delineated text?

On Tue, 31 Jul 2007 14:52:21 -0400, Jerry Stuckle wrote:
> Peter H. Coffin wrote:
>> On Tue, 31 Jul 2007 12:56:50 -0400, Jerry Stuckle wrote:
>>> lyonnyte wrote:
>>>> Is there a way to import using LOAD DATA INFILE when the file is non-
>>>> delineated?
>>>>
>>> How do you know where one field ends and another one begins?

>>
>> Often, in general, this kind of thing is done by column position. Which
>> makes the answer, I believe, no.
>>

>
> Yes, that's a possibility (and one I'm surprised MySQL doesn't support).
> But are there others?
>
> For instance, I've seen cases where you have a mix of numbers and text.
> Numbers are separated by blanks, while text is enclosed in quotes.
> Similar to CSV, except there is no comma between the values. What a
> pain to parse :-)
>


.... FIELDS TERMINATED BY '\ ' ENCLOSED BY '\"' ESCAPED BY '\\' ...

That one's *dumb*, but not horrible... (;

--
6. I will not gloat over my enemies' predicament before killing them.
--Peter Anspach's list of things to do as an Evil Overlord
Reply With Quote