Skip to Content (Press Enter)
OutSystems.com
Personal Edition
Community
Support
Training
Training
Online Training
Developer Schools
Boot Camps
Certifications
Tech Talks
Documentation
Documentation
Overview
ODC
O11
Forums
Forge
Get Involved
Get Involved
Jobs
Ideas
Members
Mentorship
User Groups
Platform
Platform
ODC
O11
Search in OutSystems
Log in
Get Started
Back to Forums
Robrecht Colson
86
Views
3
Comments
Drop record with ID 0
Question
Hey guys,
Because of sloppy coding I have three records of an entity where the ID is 0. This shouldn't be so bad, given that it's a test environment, but for practice I tried to delete it with a SQL statement. However, I always get an error that says the key can't be null. Does anyone know how to delete a row with ID 0?
Many thanks in advance,
Robrecht
Curt Raddatz
You should be able to do this. I did a quick test and it seemed to work.
In the eSpace where the entity is declared create an action. In that action create an advanced query. In the advanced query, use the following syntax.
delete
from
{<EntityName>}
where
{<EntityName>}
.
[Id]
=
0
Be sure to replace <EntityName> with the actual entity being affected. Create a structure called SQLResult with just one integer entity. Use this structure as the output structure for the advanced query. Click the Test button and the query should run, deleting the records with ID = 0.
Hope this helps,
Curt
Robrecht Colson
That's what I tried, except that I also added a select {Entity}.* as first line. I later noticed I could just use my Delete action to delete them manually after putting a Delete rule on Delete instead of Protect. Thanks for the help, I'm definitely coming back to this post in the future :)
Niels Favreau
delete
from
{<EntityName>}
where
{<EntityName>}
.
[Id]
=
0
COMMIT;
You will get an error, but it will be deleted.
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
See the full guidelines
Loading...