I have 3 tables. WORK, SYSTEM and TASKS
The relationship among these 3 tables are
WORK has PK WORK_ID
SYSTEM has WORK_ID but it is FK as name "ST_WRK_FK"
TASKS has WORK_ID but it is FK as name "ET_WRK_FK"
Now I want to remove records in WORK. First I delete all its child tables records associated with it
Now I turn out the following error
Msg 547, Level 16, State 0, Line 4
The DELETE statement conflicted with the REFERENCE constraint "ET_WRK_FK". The conflict occurred in database "test1", table "dbo.TASKS", column 'WORK_ID'.
The statement has been terminated.
I check the tables TASKS and SYSTEM, all the associated records are removed. I don't understand why I cannot remove records from WORK which is the parent table.
What I went wrong? How to fix this issue?