Results 1 to 5 of 5

Thread: I get this error every time I exceed 127 lines..

  1. #1
    Join Date
    Feb 2003
    Posts
    11

    I get this error every time I exceed 127 lines..

    Error

    SQL-query :

    LOAD DATA INFILE 'text.txt' INTO TABLE `products` FIELDS TERMINATED BY ';' ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY '\r\n'

    MySQL said:


    Duplicate entry '127' for key 1

    What's the deal man?! Everytime I import a textfile into phpmyadmin it only EVER imports 127 rows and then I get this error?! Anybody know why?

    I'm desperate here!

  2. #2
    Join Date
    Feb 2003
    Posts
    11

    Even if I try to add a row directly from phpmyadmin...

    What is this program trying to say to me...as soon as I attempt to hit row 128 it give me this error message:

    Duplicate entry '127' for key 1


    What IS THE DEAL!? I can't figure it out! Please tell me there's someone who knows the answer to this one!

    thanks

  3. #3
    Join Date
    Feb 2003
    Location
    Johannesburg, South Africa
    Posts
    145
    It means you have created a primary key - which can only have a unique value, and you are now trying to add a row for which a key was already used previously.

    Example: You have a product table, which includes a primary key on field "product_id". You now start to add products, and your product id's are entered as 1, 2, 3, 4 etc. At some stage, you might be trying to enter a product with id 4 again, which is not allowed as a product with that id was already enetered previously.

    Solution:

    1) Fix the entry causing the duplicate entry; OR

    2) Remove the primary index, if you want to allow duplicate entries - not usually used.

    Reference: http://www.mysql.com/doc/en/CREATE_TABLE.html

    Cheers

  4. #4
    Join Date
    Dec 2002
    Location
    Cape Town, South Africa
    Posts
    75
    I presume this was answered in this thread - ie you'd defined the primary key as a TINYINT, which can only take 127 records.

  5. #5
    Join Date
    Feb 2003
    Location
    Johannesburg, South Africa
    Posts
    145
    Originally posted by greenman
    I presume this was answered in this thread - ie you'd defined the primary key as a TINYINT, which can only take 127 records.
    I assumed he fixed that problem - but your'e right - it could still be part of that problem.

    Cheers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •