Unsupported Screen Size: The viewport size is too small for the theme to render properly.

Error importing from Access

  • This topic is empty.
Viewing 1 reply thread
  • Author
    Posts
    • #8095
      xinelo
      Member

      I´m quite sure I´ve created my DSN file properly because most of times the data import runs well. However there´s a problem with copying tables from the data source in MS Access 2000, I can´t see why. I get the message:

      “There was an error while executing a query. The query and the error message have been logged at bla bla bla”

      And the error query is

      insert into `termos` (`id_termo`, `termo`, `id_cat_gramatical`, `id_subarea`, `definicion`, `nota`, `nota_traballo`, `imaxe`, `validado` ) values (416, 'mandil de mostra', 's m', 'V', 'Mandil de picote de gala', NULL, NULL, NULL, 0)

      I´m new to SQL but I think I know enough to write a correct insert query, and to me this one seems correct!

      In the same dialog box I get the description message:

      Duplicate entry '416' for key 1

      but I don´t know what it means.

      Other times I get another error message when trying to import data but it hasn´t happened recently.

      I´d be very grateful if someone could help with this.

    • #14680
      Shadow
      Member
      Quote:
      Duplicate entry '416' for key 1

      The answer is in the SQL statement you included in your question: the statement tries to insert the value 416 to the field “id_termo”, but the table already contains a record with the same id_termo. id_termo is the primary key for the table (at least, I guess it is), so it must be unique.

      Possible causes:

      – you forgot to declare id_termo field as primary key in Access

      – the Access db is corrupt (allowed the insertion of the same value more than once) – a slim chance

      – you try to import records that already exist in the MySql db, try writing your own import query instead of copying the whole table

Viewing 1 reply thread
  • You must be logged in to reply to this topic.