Gossamer Forum
Home : Products : Gossamer Links : Discussions :

How To Insert just SOME fields from File

Quote Reply
How To Insert just SOME fields from File
Hi:

In my install, I often will work on 100's of new entries, upload them as a txt file, and then put them into the database with Load Infile, like thus:

LOAD DATA INFILE 'Arr.txt' REPLACE INTO TABLE `Links` FIELDS TERMINATED BY '|' ESCAPED BY '\\' LINES TERMINATED BY '\n' IGNORE 0 LINES

Works great.

Now I want to add some new data to existing entries. I could download all the data, and then re-upload with the above comant... but why should I if I am only adding an image link? Why not just get the ID, Issue, and put the image with it, and insert that?

So I tried:

LOAD DATA INFILE 'Arr.txt' REPLACE INTO TABLE `Links` (ID, Issue, Image) FIELDS TERMINATED BY '|' ESCAPED BY '\\' LINES TERMINATED BY '\n' IGNORE 0 LINES

which did, in fact, insert all three fields appropriately... however, it DELETED all the other info! Luckily, I was practicing on a non-needed row, and only one, so I did not kill anything important!

So, my question is, how can I load an infile and just insert SOME data, w/o deleting all the rest? Or should I give it up, and d/l and insert ALL the data?

dave

Big Cartoon DataBase
Big Comic Book DataBase
Subject Author Views Date
Thread How To Insert just SOME fields from File carfac 1677 Jun 9, 2004, 9:57 AM
Thread Re: [carfac] How To Insert just SOME fields from File
Andy 1630 Jun 9, 2004, 9:59 AM
Post Re: [Andy] How To Insert just SOME fields from File
carfac 1627 Jun 9, 2004, 11:10 AM