delete_from

The delete_from statement enables you to delete multiple records from the database at the same time. This means that there is only one call required to the database from the Microsoft Dynamics AX client. as opposed to the multiple calls required if you use the delete statement.

This reduction in the number of calls required speeds up system performance. It also enables you to specify multiple deleted items in a clearer, simpler manner.

In situations where the delete method is overridden, the system transparently emulates the situation of selecting and deleting one record at a time so that the overridden delete method is executed.

Example 1- DELETE_FROM

Example 2- DELETE

MyTable myTable;

;

delete_from myTable

    where myTable.AmountMST <='1000';

ttsBegin;

while select forUpdate myTable

    where myTable.AmountMST <='1000';

myTable.delete();

ttsCommit;

Example 1 deletes all records from the myTable table that have an AmountMST value less than or equal to 1000. All records that satisfy this criterion are deleted from the database in a single action.

Example 2 deletes all records from the myTable table that have an AmountMST value less than or equal to 1000. All records that satisfy this criterion are deleted from the database one at a time.

Community Additions

ADD
Show: