#1005 - Can't create table (errno: 121)
Hej.Jeg har i min table has følgende kode:
CREATE TABLE IF NOT EXISTS `Has` (
`Id` int(11) NOT NULL,
`Serial` int(11) NOT NULL,
PRIMARY KEY (`Id`,`Serial`),
KEY `Serial` (`Serial`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Data dump for tabellen `Has`
--
INSERT INTO `Has` (`Id`, `Serial`) VALUES
(3, 699),
(2, 1001),
(1, 1120),
(1, 1234);
Nu vil jeg gerne tilføje dette kode i min Has:
ALTER TABLE `Has`
ADD CONSTRAINT `Has_ibfk_1` FOREIGN KEY (`Id`) REFERENCES `Shops` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `Has_ibfk_2` FOREIGN KEY (`Serial`) REFERENCES `Dvds` (`Serial`) ON DELETE CASCADE ON UPDATE CASCADE;
Men hvergang jeg prøver får jeg denne fejl:
http://postimage.org/image/6y9rrjouz/
Er der nogen der har en ide om hvad det kan være?
Mvh Mads