Ver Mensaje Individual
  #3 (permalink)  
Antiguo 05/03/2010, 11:21
Avatar de gnzsoloyo
gnzsoloyo
Moderador criollo
 
Fecha de Ingreso: noviembre-2007
Ubicación: Actualmente en Buenos Aires (el enemigo ancestral)
Mensajes: 23.324
Antigüedad: 16 años, 5 meses
Puntos: 2658
Respuesta: Error relacion

Puede ser una cuestión de orden, porque en esta secuencia no hay problemas:

Primero:

Código MySQL:
Ver original
  1. CREATE TABLE `zone` (
  2. `zone` int(11) NOT NULL,
  3. `MerchandizerId` int(11) ,
  4. PRIMARY KEY (`zone`),
  5. KEY `MerchandizerId` (`MerchandizerId`)

Luego:

Código MySQL:
Ver original
  1. CREATE TABLE `customers` (
  2. `CustomerId` int(11) NOT NULL,
  3. `CustomerName` varchar(100) NOT NULL,
  4. `CustomerZone` int(11) default NULL,
  5. `Mon` tinyint(1) NOT NULL,
  6. `Tue` tinyint(1) NOT NULL,
  7. `Wed` tinyint(1) NOT NULL,
  8. `Thu` tinyint(1) NOT NULL,
  9. `Fri` tinyint(1) NOT NULL,
  10. `Sat` tinyint(1) NOT NULL,
  11. PRIMARY KEY (`CustomerId`),
  12. KEY `CustomerZone` (`CustomerZone`)

Y después:

Código MySQL:
Ver original
  1. ALTER TABLE `customers`
  2. ADD CONSTRAINT `FK_Zon_Cust` FOREIGN KEY (`CustomerZone`) REFERENCES `zone` (`zone`);
__________________
¿A quién le enseñan sus aciertos?, si yo aprendo de mis errores constantemente...
"El problema es la interfase silla-teclado." (Gillermo Luque)