Insert Bulk Account Records

How to insert bulk account records

Execute the below script in developer console to insert bulk account records.

For(integer i=0; i<10; i++) { 
	Account acc = new Account(Name='Dummy Record '+i, AccountNumber='Test'+i, Rating='Hot');
    Insert acc;
}
Script to insert 10000 records once
List<Account> accountsToInsert = new List<Account>();
for (Integer i = 0; i < 10000; i++) {
    Account acc = new Account(
        Name='Dummy Record '+i+2, AccountNumber='Testing'+i, Rating='Hot'
    );
    accountsToInsert.add(acc);
}

insert accountsToInsert;

Leave a Reply