Adding data to a MySQL table = error

wxdqz

New Member
Hi,

I'm trying to add some records to a Mysql table using the LOAD DATA INFILE instruction but I always get errors.
The command I am using is:

mysql> LOAD DATA INFILE '/path/htdocs/film.txt' INTO TABLE film_vhs LINES TERMINATED BY '\n';

And the stupid error I get is:

ERROR 1062: Duplicate entry '0' for key 1

Table structure is as follows:

mysql> describe film_vhs;
+-------------+----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+----------------------+------+-----+---------+-------+
| codice | smallint(5) unsigned | | PRI | 0 | |
| titolo | varchar(100) | | MUL | | |
| registac | varchar(15) | YES | | NULL | |
| registan | varchar(15) | YES | | NULL | |
| attore1c | varchar(15) | YES | | NULL | |
| attore1n | varchar(15) | YES | | NULL | |
| attore2c | varchar(15) | YES | | NULL | |
| attore2n | varchar(15) | YES | | NULL | |
| attore3c | varchar(15) | YES | | NULL | |
| attore3n | varchar(15) | YES | | NULL | |
| annofilm | smallint(4) unsigned | YES | | NULL | |
| durata | smallint(3) unsigned | YES | | NULL | |
| genere | varchar(10) | YES | | NULL | |
| descrizione | text | YES | | NULL | |
| dataacq | date | YES | | NULL | |
+-------------+----------------------+------+-----+---------+-------+
15 rows in set (0.00 sec)

The txt file I am using has rows like this:

#5356#^#DINK -IL PICCOLO DINOSAURO#^^^^^^^^^#1993#^#60#^#Ragazzi#^^#19931126#
#5357#^#TRAPPOLA IN ALTO MARE#^#DAVIS#^#ANDREW#^#SEAGAL#^#STEVEN#^#JONES#^#TOMMY LEE#^^^#1993#^#104#^#Azione#^#Non e' una missione... e' un' avventura vera e propria!! Steven Seagal sale a bordo, e ci sale alla grande, combinando houmor ed eroismo in un film decisamente esplosivo. Il divertimento ha inizio quando la Missuri ospita a bordo musicisti e squadre di approvvigionamento, con il compito d'intrattenere i protagonisti dell' ultimo viaggio della corazzata americana.#^#19931130#

I am really in trouble trying to understand why I get that error...primary key is not duplicated but it seems something like that is happening...

Thank you for your help.

Fabio
 
Back
Top