/*==============================================================*/ /*==============================================================*/ alter table H_Dict_Channel_Source add constraint FK_H_Dict_Channel_Source_FK_A foreign key [Err] 1215 – Cannot add foreign key constraint 程序报错,大神们帮忙看下 |
|
….找到问题了,表明错了
|
|
40分 |
alter table H_Dict_Channel_Source add constraint FK_H_Dict_Channel_Source_FK_A foreign key
(Channel_Type_Code) references H_Dict_Channel_Type (Code); 你的这个表根本没有创建。 mysql> create table H_Dict_Channel_Type (Code varchar(20) primary key)ENGINE=Inn oDB DEFAULT CHARSET=gbk; Query OK, 0 rows affected (0.05 sec) mysql> create table IF NOT EXISTS H_Dict_Channel_Source -> ( -> Code varchar(20) not null, -> Channel_Type_Code varchar(20) not null, -> Name national varchar(50) not null, -> Memo national varchar(100), -> Is_Valid bool not null, -> Creator_Code varchar(20) not null, -> Create_Time bigint not null, -> primary key (Code), -> constraint FK_H_Dict_Channel_Source_FK_A foreign key -> (Channel_Type_Code) -> references H_Dict_Channel_Type -> (Code) -> )ENGINE=InnoDB DEFAULT CHARSET=gbk; Query OK, 0 rows affected (0.06 sec) mysql> |