Quantcast
Channel: MySQL Forums - MySQL Workbench
Viewing all articles
Browse latest Browse all 3724

Error 1022: Can't write; duplicate key (no replies)

$
0
0
Hi:
I need some helps with the following problem. It looks like the error message is so straight forward and problem can be fixed as explained in my poeple postings on web. But I couldn't find anywhere in the script through the forward engineering on workbench that uses any duplicate field, not on blockID, nor fkMethodID. So I am confused as why the error and the message. Can someone kindlyhelp in explaining? Thanks ahead.


-- -----------------------------------------------------
-- Table `test2`.`method`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `test2`.`method` ;

CREATE TABLE IF NOT EXISTS `test2`.`method` (
`MethodID` TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
`Abbr` CHAR(1) NOT NULL,
`Desc` VARCHAR(45) NOT NULL,
PRIMARY KEY (`MethodID`),
UNIQUE INDEX `MethodID_UNIQUE` (`MethodID` ASC))
ENGINE = InnoDB;



-------------------------------




Executing SQL script in server

ERROR: Error 1022: Can't write; duplicate key in table 'building'

CREATE TABLE IF NOT EXISTS `test2`.`block` (

`blockID` TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,

`blockNum` VARCHAR(3) NOT NULL,

`fkMethodID` TINYINT UNSIGNED NOT NULL,

PRIMARY KEY (`blockID`),

UNIQUE INDEX `blockID_UNIQUE` (`blockID` ASC),

INDEX `fkMethodID_idx` (`fkMethodID` ASC),

CONSTRAINT `fkMethodID`

FOREIGN KEY (`fkMethodID`)

REFERENCES `test2`.`method` (`MethodID`)

ON DELETE NO ACTION

ON UPDATE NO ACTION)

ENGINE = InnoDB

Viewing all articles
Browse latest Browse all 3724

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>