The folowing is out of the current MySQL manual. It looks like you could
create an intermediate table with the fields you are interested in the front
and "garbage" fields on the end. Then build a specific LOAD DATA INFILE with
correct mapping for each file type [assuming you can tell this in your
automated process]. Then after loading all 200 of your files run 1
INSERT...SELECT... with just the pertinent FIELDS from the intermediate
table to your final table and TRUNCATE the intermediate table. 

It probably makes sense for the intermediate table to have minimal indexing
so the initial loads will run faster.
_________________________________________________________________________
mysql> LOAD DATA INFILE 'persondata.txt'
    ->           INTO TABLE persondata (col1,col2,...);

You must also specify a column list if the order of the fields in the input
file differs from the order of the columns in the table. Otherwise, MySQL
cannot tell how to match up input fields with table columns. 

If an input line has too many fields, the extra fields are ignored and the
number of warnings is incremented. 

If an input line has too few fields, the table columns for which input
fields are missing are set to their default values. Default value assignment
is described in section 13.2.6 CREATE TABLE Syntax. 

____________________________________________________________________________
-----Original Message-----
From: Jessica Svensson [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 25, 2005 12:28 PM
To: mysql@lists.mysql.com
Subject: Re: LOAD DATA and skip columns in text file...

That just complicates things alot since i get around 200 files, 6 times a 
day via an automated process and every textfile looks different from the 
other. To just have different load data would make it much easier.

I have read alot of questions about just this and many people is asking for 
this feature. Thats why i'm woundering if it really havent been impemented 
in these 5 years that have passed.

>From: Harald Fuchs <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: mysql@lists.mysql.com
>Subject: Re: LOAD DATA and skip columns in text file...
>Date: 25 May 2005 13:24:55 +0200
>
>In article <[EMAIL PROTECTED]>,
>"Jessica Svensson" <[EMAIL PROTECTED]> writes:
>
> > LOAD DATA and skip columns in text file...
> > What i have found out is that this is not possible in any existing
> > version of mysql, correct?
>
>
> > I found a message from Sinisa Milivojevic @ MySQL AB dated 06/29/2000
> > while searching on google.
>
> > It said "We have entered this on our TODO list one month ago."
>
> > So that would be almost exactly 5 years ago... is it really that this
> > function has not been implemented during these 5 years? If so, then i
> > guess it could be 5 more years before its impelemented and that i
> > should maybe look for other solutions.
>
>Maybe they didn't implement it yet because there's an easy workaround:
>create a temporary table including the columns to be skipped, LOAD it,
>and then use INSERT..SELECT to copy over only the columns you're
>interested in.
>
>
>--
>MySQL General Mailing List
>For list archives: http://lists.mysql.com/mysql
>To unsubscribe:    
>http://lists.mysql.com/[EMAIL PROTECTED]
>

_________________________________________________________________
Lättare att hitta drömresan med MSN Resor http://www.msn.se/resor/


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to