General X++ Development
How do I update multiple records using `update_recordset` in X++?
How do I update multiple records using update_recordset in X++?
1 answer
Write an answerUse update_recordset when the update can be done as a set instead of row by row.
SalesTable salesTable;
ttsBegin;
update_recordset salesTable
setting YourCustomField = NoYes::Yes
where salesTable.CustAccount == 'US-001';
ttsCommit;For a simple bulk update, this is usually much better than looping through thousands of records and calling update() one at a time.
Just remember that set-based operations can fall back to row-by-row behavior depending on table logic, so do not assume every update_recordset is automatically one SQL statement.
Know the solution?
Sign in to contribute an answer and build your community reputation.
Sign in to answer