FK no MySql 5.0

Delphi

16/08/2009

Olá,
estou tentando utilizar fk no mysql 5.0. numa tabela, quando tento incluir os dados manualmente, atraves do front end, da a seguinte msg:
Cannot add or update a child row: a foreign key constraint fails (´bd_educacao´.´tb_cargo´, CONSTRAINT ´FK_tb_cargo´ FOREIGN KEY (´cargo_cod´) REFERENCES ´tb_faltas´ (´falt_cod_cargo´))


A definição da tabela é a seguinte:
CREATE TABLE ´tb_cargo´ (
  ´cargo_cod´ int(11) NOT NULL AUTO_INCREMENT,
  ´cargo_descricao´ varchar(100) NOT NULL,
  PRIMARY KEY (´cargo_cod´),
  CONSTRAINT ´FK_tb_cargo´ FOREIGN KEY (´cargo_cod´) REFERENCES ´tb_faltas´ (´falt_cod_cargo´),
  CONSTRAINT ´FK_tb_cargo_mapa´ FOREIGN KEY (´cargo_cod´) REFERENCES ´tb_mapa_faltas´ (´mapa_cod_cargo´),
  CONSTRAINT ´FK_tb_cargo_reposicao´ FOREIGN KEY (´cargo_cod´) REFERENCES ´tb_reposicao´ (´reposicao_cod_cargo´),
  CONSTRAINT ´FK_tb_cargo_servidor´ FOREIGN KEY (´cargo_cod´) REFERENCES ´tb_servidor´ (´servidor_cod_cargo´)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC

se alguem puder me ajudar, agradeço.


Dbergkamps10

Dbergkamps10

Curtidas 0

Respostas

Vmlima

Vmlima

16/08/2009

Isso quer dizer que vc não tem o valor da FK da tabela detalhe como PK na tabela mestre
Por exemplo, vc insere tem na tabela filha o codigo 500 no FK, mas na tabela master não tem esse PK...

Att..


GOSTEI 0
POSTAR