Hi, this is Sateesh,
Let me know one thing: a better way to delete the records from the database. either like entity delete action or write SQL query. and also give me one example of writing an SQL query to delete data from the database that should be joins.
Hi Sateesh,
You have choose to use the logic exclusion, using the Is_Active (boolean) attribute to control the exclusion, or physical exclusion.
The good side of logic exclusion is to keep data history for later consultation or auditing when necessary.
For physical exclusion, you have two options:
CRUD actions, that you can use Delete action to delete 1 record using the Entity Identifier.
Use Advanced Query (SQL Query) to execute a bulk delete. See an example:
Delete from {MyEntity} where {MyEntity}.[MyDate]< @LimitDate
"Massive deletes are faster in SQL queries than using Entity Actions"
So, answering your question, when you need to perform massive update or delete operations, Bulk Operations will be the best approach
Regards,
Pedro Costa
let me know how to write an SQL query to delete join records from the database. could please give me one example.
thanks,
sateesh.
Just do as it is in the link that Pedro Marques mentioned.
But, follow image representing in Advanced Query.
thanks a lot, Pedro Costa.
Hi Telugu,
To delete several records at once is always better to perform a bulk operation using a SQL query (more here https://success.outsystems.com/Documentation/Best_Practices/Performance_and_Monitoring/Performance_Best_Practices_-_Queries)
For an example of a Delete statement with joins you can check this link https://stackoverflow.com/questions/16481379/how-can-i-delete-using-inner-join-with-sql-server
Hope this helps,
Pedro
thanks, Pedro.
Helpful post, Thank you.
Hi Pedro Costa, I am trying to delete using an IN clause on EmployeeId and it fails if there are more than two ids in a IN clause. It works fine if there is a single value.
Can help on this pls