On Wed, 1999-09-22 12:34:50 +0300, Bogdan Paduraru wrote:
> LOAD DATA LOCAL INFILE file_path/file_name INTO TABLE log, wich is ok.
> The problem is next time the file will have the same lines plus 1 to
> N new lines. What can I do to make mySQL to load from that file
> only the new lines (that 1 to N), the ones nonexistent in my table
> (previously loaded), without the lines loaded last time.
You should define a PRIMARY KEY or an UNIQUE INDEX on this table.
LOCAL INFILE 'file_path/file_name'
IGNORE /* <- this is the main point */
INTO TABLE log;
With IGNORE duplicates are skipped. Alternatively you could use
REPLACE and duplicates (with respect to the UNIQUE INDEX) replace
See chapter "7.15 LOAD DATA INFILE syntax" of the MySQL manual.
Martin Ramsch <m.ramsch@stripped> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26 E4 EC 80 58 7B 31 3A D7