I have two tables, Client and Plan, which have the 1:1
relationship. I have 3 plans registered in the bank with their respective data. But when trying to insert a Client that has a Foreing Key
that is referring to Id
of the chosen Plan. At the moment of inserting the data I have the following error:
The INSERT statement conflicted with the FOREIGN KEY constraint \ "FK_dbo.Customer.Plans_Indicator \". The statement occurred in database \ "MyBank \", table \ "dbo.Planos \", column \ 'PlanId'. \ R \ nThe statement has been terminated.
My query
insert into Clientes values(NEWID(),'Nome do Cliente', '000.000.000-52', '001122','14966034-BC78-4B77-B817-4EC7AC483B05','logradouro','bairro','cep', 'telefone','email');
This is the value of Id
of the existing Plan in the database:
14966034-BC78-4B77-B817-4EC7AC483B05
% of bank%: