Jump to content

problem when insert data into table


whitemoss

Recommended Posts

Hi All,

I tried to insert a data into a table but it didnt work. The error is: ERROR 1062: Duplicate entry '868648' for key 1

My table structure is:

mysql> desc mohelp;
+--------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+------------------+------+-----+---------+----------------+
| RecordID | int(10) unsigned | | PRI | NULL | auto_increment |
| DateInsert | datetime | YES | | NULL | |
| DateSend | datetime | YES | MUL | NULL | |
| MONumber | varchar(20) | YES | | NULL | |
| MobileNumber | varchar(20) | YES | MUL | NULL | |
| Message | varchar(225) | YES | | NULL | |
| Status | tinyint(1) | YES | | 0 | |
| TransID | varchar(20) | YES | | NULL | |
+--------------+------------------+------+-----+---------+----------------+


Hope anyone can help me regarding this matter.
Link to comment
Share on other sites

It looks like you're trying to insert data with RecordID set to '868648', but another row in the table already has that id. If a column is set as the primary key then you may not have two rows with that column set to '868648'.

It is set to AUTO_INCREMENT so you shouldn't be trying to insert anything into that column.
Link to comment
Share on other sites

I dunt insert any value for RecordID since it was an auto_increment but I still get the error.Below is my insert query.


insert into mohelp(DateInsert,DateSend,MONumber,MobileNumber,Message,Status,TransID) values ('2005-02-14 10:07:56','2005-02-14 10:07:56
','28882','0192426699','Help',1,'987654');
ERROR 1062: Duplicate entry '868648' for key 1
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.