[MySQL] #1062 - Duplicate entry '1' for key 'PRIMARY' Help me! -
PawnCoder - 12.09.2012
SQL sorgusu:
--
-- Tablo dцkьm verisi `aracanahtarlar`
--
INSERT INTO `aracanahtarlar` ( `SiraNo` , `AracID` , `SQLID` )
VALUES ( 1, 1, 2014 ) , ( 2, 1, 2013 ) , ( 3, 1, 2015 ) , ( 4, 1, 2012 ) ;
MySQL зıktısı:
#1062 - Duplicate entry '1' for key 'PRIMARY'
Help me please.
Re: [MySQL] #1062 - Duplicate entry '1' for key 'PRIMARY' Help me! -
Roach_ - 12.09.2012
In the column you must put something like: "`Key` INTEGER PRIMARY KEY AUTOINCREMENT"
And you must not set it
Respuesta: [MySQL] #1062 - Duplicate entry '1' for key 'PRIMARY' Help me! -
Siralos - 12.09.2012
You have probably defined 'AracID' as primary key. Could you please paste the definition of the table?
Re: [MySQL] #1062 - Duplicate entry '1' for key 'PRIMARY' Help me! -
PawnCoder - 12.09.2012
-- Tablo iзin tablo yapısı `aracanahtarlar`
--
CREATE TABLE IF NOT EXISTS `aracanahtarlar` (
`SiraNo` int(11) NOT NULL AUTO_INCREMENT,
`AracID` int(11) NOT NULL,
`SQLID` int(11) NOT NULL,
PRIMARY KEY (`SiraNo`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
--
-- Tablo dцkьm verisi `aracanahtarlar`
--
INSERT INTO `aracanahtarlar` (`SiraNo`, `AracID`, `SQLID`) VALUES
(1, 1, 2014),
(2, 1, 2013),
(3, 1, 2015),
(4, 1, 2012);
Table of this, as well as my english is a little bad because I'm Turkish. I'd appreciate if you type a more descriptive.
Re: [MySQL] #1062 - Duplicate entry '1' for key 'PRIMARY' Help me! -
Roach_ - 12.09.2012
Try this:
pawn Код:
CREATE TABLE IF NOT EXISTS `aracanahtarlar` (
`SiraNo`INTEGER PRIMARY KEY AUTOINCREMENT,
`AracID` int(11) NOT NULL,
`SQLID` int(11) NOT NULL,
PRIMARY KEY (`SiraNo`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
And you must not set it:
pawn Код:
INSERT INTO `aracanahtarlar` (`AracID`, `SQLID`) VALUES
(1, 2014),
(1, 2013),
(1, 2015),
(1, 2012);
It will auto-increase..
Re: [MySQL] #1062 - Duplicate entry '1' for key 'PRIMARY' Help me! -
PawnCoder - 12.09.2012
Like you said, another error comes when you have made.
Quote:
SQL sorgusu:
--
-- Veritabanı: `newyorkrpg`
--
-- --------------------------------------------------------
--
-- Tablo iзin tablo yapısı `aracanahtarlar`
--
CREATE TABLE IF NOT EXISTS `aracanahtarlar` (
`SiraNo` INTEGER PRIMARY KEY AUTOINCREMENT,
`AracID` int( 11 ) NOT NULL ,
`SQLID` int( 11 ) NOT NULL ,
PRIMARY KEY ( `SiraNo` ) ) ENGINE = InnoDB DEFAULT CHARSET = latin1 AUTO_INCREMENT =5;
MySQL зıktısı:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AUTOINCREMENT,
`AracID` int(11) NOT NULL,
`SQLID` int(11) NOT NULL,
PRIMARY KEY ' at line 12
|
Respuesta: [MySQL] #1062 - Duplicate entry '1' for key 'PRIMARY' Help me! -
Siralos - 12.09.2012
pawn Код:
CREATE TABLE IF NOT EXISTS `aracanahtarlar` (
`SiraNo` INTEGER AUTO_INCREMENT,
`AracID` int( 11 ) NOT NULL ,
`SQLID` int( 11 ) NOT NULL ,
PRIMARY KEY ( `SiraNo` ) ) ENGINE = InnoDB DEFAULT CHARSET = latin1 AUTO_INCREMENT =5
Try that
Re: [MySQL] #1062 - Duplicate entry '1' for key 'PRIMARY' Help me! -
PawnCoder - 12.09.2012
Problem fixed.