1
I have a "Terms" table that your ID is FK from "Thermosexpresso".
As shown in the figure below.
When I run the command "delete Terms Where Idtermo = 4" sql generates me
the following error.
The DELETE statement conflicted with the REFERENCE Constraint "Fk_thermoexpression". The Conflict occurred in database "Sprintjuncao", table "dbo.Termoexpressao", column 'Idtermoexpressao'. The statement has been terminated.
From what I read it seems that this is a cascade deletion, when I delete the record of "Terms" I should automatically delete the records related to "Thermosexpresso", In the case of all records in Thermosexpression with Idtermo = 4
Can anyone help me how I should proceed in this case?
you will have to delete the data from the table first
TermoExpressao
, you can do it like thisdelete dbo.TermoExpressao where IDTermo = 4
– Pablo Tondolo de Vargas
Another thing you could do would be change your FK to be
delete cascade
– Pablo Tondolo de Vargas
@Pablovargas I think the correct in my case would be this delete?
– Marconi