When creating a foreign key in firebird, the error violation of the FOREIGN KEY restriction "PK_ROLES1" in the "roles" table comes out?

131 views Asked by At

I am trying to create a foreign key in the user_roles table.It has a user_id and a roles_id. I created a foreign key for user_id. And for roles_id it is not possible to create. I work at ibexpert. An error comes out: violation of FOREIGN KEY constraint "PK_RULES 1" on table "rules".I will be glad of any help.

alter table "users_roles"
add constraint FK_USERS_ROLES_2
foreign key (ROLE_ID)
references "roles"(ID)
on delete CASCADE
on update CASCADE
using index FK_USERS_ROLES_2
0

There are 0 answers