更新时间:2023-02-05 13:32:05
您需要先删除约束,然后重新创建它.您的第二次尝试是正确的,但您需要删除 和
.
You need to drop constraint first, and then recreate it. Your second attempt was right, but you needed to remove and
.
alter table AllowedCars
drop constraint FK_AllowedCars_CarID
alter table AllowedCars
add constraint FK_AllowedCars_CarID
foreign key (CarID)
references Cars(CarID)
on delete cascade
on update cascade