You need to sign in to do that
Don't have an account?

Why is the following code giving Too many DML rows:10001 error message
I am trying to update some accounts in the anonymous window and get the Too many DML rows error message. What am I doing wrong?
Yogesh
List<Account> acc = new List<Account>(); for(Account a:[SELECT Id, Industry from Account WHERE Industry='Architect']){ a.Industry='Architecture'; acc.add(a); } update acc;
Yogesh
No need to something like above.
All Answers
Hope this helps,
Shawn
SELECT Id, Industry from Account WHERE Industry='Architect' limit 10000.
In case you do not want to update the same rows over and over again , add another filter using lastmodifieddate to ignore the ones which are updated today. This filter you can add after the first run of anonymous block.
No need to something like above.