Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/03/2010, 10:54
angelmf
 
Fecha de Ingreso: febrero-2008
Mensajes: 133
Antigüedad: 16 años, 2 meses
Puntos: 0
Exclamación Error relacion

HOLA BUENOS DIAS TENGO LA SIGUIENTE ESTRUCTURA DE TABLAS, A LAS CUALES QUISIERA INGRESAR UNA RELACIÓN ENTRE AMBAS, PERO AL HACERLO ME DA ERROR "Cannot add or update a child row" EL SCRIPT UTILIZADO PARA AGREGAR LA RELACIÓN ES EL SIGUIENTE:

ALTER TABLE `customers`
ADD CONSTRAINT `FK_Zon_Cust` FOREIGN KEY (`CustomerZone`) REFERENCES `zone` (`zone`);

Y LAS ESTRUCTURAS DE LAS TABLAS:

--
-- Estructura de tabla para la tabla `customers`
--

CREATE TABLE `customers` (
`CustomerId` int(11) NOT NULL,
`CustomerName` varchar(100) NOT NULL,
`CustomerZone` int(11) default NULL,
`Mon` tinyint(1) NOT NULL,
`Tue` tinyint(1) NOT NULL,
`Wed` tinyint(1) NOT NULL,
`Thu` tinyint(1) NOT NULL,
`Fri` tinyint(1) NOT NULL,
`Sat` tinyint(1) NOT NULL,
PRIMARY KEY (`CustomerId`),
KEY `CustomerZone` (`CustomerZone`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;



--
-- Estructura de tabla para la tabla `zone`
--

CREATE TABLE `zone` (
`zone` int(11) NOT NULL,
`MerchandizerId` int(11) ,
PRIMARY KEY (`zone`),
KEY `MerchandizerId` (`MerchandizerId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


AGRADECIDO DE ANTEMANO