Receiving Error while Attempting to Delete Records in an Entity

Receiving Error while Attempting to Delete Records in an Entity

  

Hi,


I am trying to delete records in an Entity "Project" using an action and I received the following error message upon doing so :

" The DELETE statement conflicted with the REFERENCE constraint "OSFRK_OSUSR_CYA_REQUIREMENT_OSUSR_CYA_PROJECT_PROJECTID". The conflict occurred in database "OSDEV1", table "dbo.OSUSR_CYA_REQUIREMENT", column 'PROJECTID'. The statement has been terminated. "

The "Requirement" Entity being referred in the error message does not contain a "Project ID" attribute, So its not a problem of Delete Rule of the Project Identifier. 

Any help would be appreciated.

Thank You

Anurag Bandla wrote:

Hi,


I am trying to delete records in an Entity "Project" using an action and I received the following error message upon doing so :

" The DELETE statement conflicted with the REFERENCE constraint "OSFRK_OSUSR_CYA_REQUIREMENT_OSUSR_CYA_PROJECT_PROJECTID". The conflict occurred in database "OSDEV1", table "dbo.OSUSR_CYA_REQUIREMENT", column 'PROJECTID'. The statement has been terminated. "

The "Requirement" Entity being referred in the error message does not contain a "Project ID" attribute, So its not a problem of Delete Rule of the Project Identifier. 

Any help would be appreciated.

Thank You

Hi, 

Can you post your entity diagram?


Priya Khade wrote:

Anurag Bandla wrote:

Hi,


I am trying to delete records in an Entity "Project" using an action and I received the following error message upon doing so :

" The DELETE statement conflicted with the REFERENCE constraint "OSFRK_OSUSR_CYA_REQUIREMENT_OSUSR_CYA_PROJECT_PROJECTID". The conflict occurred in database "OSDEV1", table "dbo.OSUSR_CYA_REQUIREMENT", column 'PROJECTID'. The statement has been terminated. "

The "Requirement" Entity being referred in the error message does not contain a "Project ID" attribute, So its not a problem of Delete Rule of the Project Identifier. 

Any help would be appreciated.

Thank You

Hi, 

Can you post your entity diagram?




Anurag Bandla wrote:

Priya Khade wrote:

Anurag Bandla wrote:

Hi,


I am trying to delete records in an Entity "Project" using an action and I received the following error message upon doing so :

" The DELETE statement conflicted with the REFERENCE constraint "OSFRK_OSUSR_CYA_REQUIREMENT_OSUSR_CYA_PROJECT_PROJECTID". The conflict occurred in database "OSDEV1", table "dbo.OSUSR_CYA_REQUIREMENT", column 'PROJECTID'. The statement has been terminated. "

The "Requirement" Entity being referred in the error message does not contain a "Project ID" attribute, So its not a problem of Delete Rule of the Project Identifier. 

Any help would be appreciated.

Thank You

Hi, 

Can you post your entity diagram?




Hello Anurag.

You have an entity called Requirement, that has a foreign key to the Project entity. You have rows there that point to the rows in project you are trying to delete. The Delete Rule is set to Protected.

Either you delete FIRST the lines in Requirement, and only after those lines are deleted you delete the project, or you change the Delete Rule to DELETE, so that the delete will be made in cascade.

Cheers.


Eduardo Jauch wrote:

Anurag Bandla wrote:

Priya Khade wrote:

Anurag Bandla wrote:

Hi,


I am trying to delete records in an Entity "Project" using an action and I received the following error message upon doing so :

" The DELETE statement conflicted with the REFERENCE constraint "OSFRK_OSUSR_CYA_REQUIREMENT_OSUSR_CYA_PROJECT_PROJECTID". The conflict occurred in database "OSDEV1", table "dbo.OSUSR_CYA_REQUIREMENT", column 'PROJECTID'. The statement has been terminated. "

The "Requirement" Entity being referred in the error message does not contain a "Project ID" attribute, So its not a problem of Delete Rule of the Project Identifier. 

Any help would be appreciated.

Thank You

Hi, 

Can you post your entity diagram?




Hello Anurag.

You have an entity called Requirement, that has a foreign key to the Project entity. You have rows there that point to the rows in project you are trying to delete. The Delete Rule is set to Protected.

Either you delete FIRST the lines in Requirement, and only after those lines are deleted you delete the project, or you change the Delete Rule to DELETE, so that the delete will be made in cascade.

Cheers.


Hi Eduardo,

As you can see from the above image, the Requirement Entity does not have Project ID attribute which is why I am confused as to why that specific error is arising. 

Solution

Well, it had, in the past, for sure :)

When you delete an attribute from an entity, this attribute is not deleted from the table in database.
So, it is there, and probably it is giving problems to you now.

One possible solution (if this is dev and the applicatioon is NOT yet in production), would be to cut/paste the entity in the module, as this would create a new table in the database, without this constraint.

Cheers.

Solution