Multiple constraints, the format becomes messy
zhiyounet
Posts: 10 New member
in SQL Prompt
before:
alter table 工料对照
add constraint ck_工料对照_工序分类编码检查 check (工序分类编码 like '0[1-8]'),
constraint ck_工料对照_父物料编码检查 check(父物料编码 like '01%'),
constraint ck_工料对照_物料编码检查 check(物料编码 like '01%'),
constraint ck_工料对照_分类检查 check(left(父物料编码,4)=left(物料编码,4)),
constraint fk_工料对照_工序分类 foreign key (工序分类编码) references 工序分类(工序分类编码),
constraint fk_工料对照_Inventory_父物料编码 foreign key (父物料编码) references Inventory(cInvCode),
constraint fk_工料对照_Inventory_物料编码 foreign key (物料编码) references Inventory(cInvCode);
alter table 工料对照
add constraint ck_工料对照_工序分类编码检查 check (工序分类编码 like '0[1-8]'),
constraint ck_工料对照_父物料编码检查 check(父物料编码 like '01%'),
constraint ck_工料对照_物料编码检查 check(物料编码 like '01%'),
constraint ck_工料对照_分类检查 check(left(父物料编码,4)=left(物料编码,4)),
constraint fk_工料对照_工序分类 foreign key (工序分类编码) references 工序分类(工序分类编码),
constraint fk_工料对照_Inventory_父物料编码 foreign key (父物料编码) references Inventory(cInvCode),
constraint fk_工料对照_Inventory_物料编码 foreign key (物料编码) references Inventory(cInvCode);
Comments