How to clean database or delete certain records manually

How to clean database or delete certain records manually

While developing my test application, I have messed up the database and now get this error when I try to delete records through my app's interface:
The DELETE statement conflicted with the REFERENCE constraint "OSFRK_OSUSR_q0d_DecisionInfluencingObjective_OSUSR_Q0D_OBJECTIVE_OBJECTIVEID". The conflict occurred in database "FO1BHE004", table "dbo.OSUSR_Q0D_DECISIONINFLUENCINGOBJECTIVE", column 'OBJECTIVEID'. The statement has been terminated.

So the question is - how can I manually fix the database to remove the above error?
I don't mind cleaning it entirely since I can easily recreate it using the app's interface.


Without seeing the entities or the DELETE statement, I'm making educated guesses but I think I can help.  You have two tables that have a foreign key link, OBJECTIVEID, between them creating (probably) a one to many relationship.  In order to delete these records you must delete the records in the 'many' part of the relationship first, then you can delete the records in the 'one' part of the relationship.  When I do this I create an action with two advanced queries with DELETE statements in the correct sequence and then create a web screen with a button that calls this action.  Then you can delete records without error any time you need to.
Thanks... this part is quite hard if you have many tables. It would be good if there was a more automated or manual way to clean up. But I figured it out
This IS tha manual way to clean this up.  No different than if you were working with SQL or Oracle directly.  Any attempt to automate something like this would not be worth the effort since it's so trivial to do it manually, probably 20 seconds per table.  One note, if you didn't notice already, use curly braces around the entity name to make your DELETE statements easier.  For example:


This causes Outsystems to replace the entity name with the actual table name with it's prefix.
With this kind of error, the database commit was not complete, so you dont have messed up the database.
The record(s) are still in the database.