MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Gary Aitken Date:June 14 2012 9:57pm
Subject:console input
View as plain text  
Hi all,

I've looked high and low for what I hope is a trivial answer.

I was trying to load a table using LOAD DATA INFILE.  Unfortunately, it craps out because
there are some duplicate primary keys.  Not surprising as the source did not enforce
uniqueness.  My problem is the load data simply dies without indicating which line of the
input file was in error; the error message refers to line 3, which is not even the SQL
statement for the LOAD DATA INTO statement:

I can get the table loaded by specifying REPLACE INTO TABLE, but that still leaves me with
not knowing where the duplicate records are.

So...  I wanted to read the data line at a time and use a plain INSERT statement.  That
way I could check for duplicate keys and discover where the duplicate records are. 
However, I can't find a way to read input from the console or a file.  What am I missing? 
I know I could write a java or C++ program to do this, but it seems like overkill for what
should be a trivial task.

Thanks for any pointers,

console inputGary Aitken15 Jun
  • Re: console inputKeith Keller15 Jun
    • Re: console inputAnanda Kumar15 Jun
  • Re: console inputJohan De Meersman15 Jun
    • Re: console inputGary Aitken15 Jun
  • Re: console inputShawn Green15 Jun
  • Re: console inputKeith Keller15 Jun