You need to sign in to do that
Don't have an account?
anil.a1.3940255032549827E12
Which is the best way to update list of records?
scenario 1 :
list<account> acc = [select id,name,Counter__c from account ];
for(account a : acc)
{
a.Counter__c = 'testCounter';
}
update acc;
scenario 2:
list<account> acc1=new list<account>();
list<account> acc = [select id,name,Counter__c from account ];
for(account a : acc){
a.Counter__c = 'testCounter';
acc1.add(a);
}
update acc1;
list<account> acc = [select id,name,Counter__c from account ];
for(account a : acc)
{
a.Counter__c = 'testCounter';
}
update acc;
scenario 2:
list<account> acc1=new list<account>();
list<account> acc = [select id,name,Counter__c from account ];
for(account a : acc){
a.Counter__c = 'testCounter';
acc1.add(a);
}
update acc1;
To understand more go to this link (http://blog.jeffdouglas.com/2010/08/16/managing-the-heap-in-salesforce-com/).