This is the actual code:
global class SICS implements Database.Batchable<Account>{
global final String Query;
string q = 'Select Id, CMSIC8A__c, Temp_BadCMSIC__c from Account' +
'where Temp_BadCMSIC__c != NULL ';
global UpdateAccountFields(String q){ Query=q;}
global Database.querylocator start(Database.BatchableContext BC){
return Database.getQueryLocator(query);}
global void execute(Database.BatchableContext BC, List<Account> scope){
LIST<Account> SIC2Up = [Select Id, CMSIC8A__c, Temp_BadCMSIC__c from Account where Temp_BadCMSIC__c != ''];
List <Account> Acc2Up = new List<Account>();
for(Account acc : scope){
IF(acc.Temp_BadCMSIC__c != NULL){
acc.CMSIC8A__c = acc.Temp_BadCMSIC__c;
}
Acc2Up.add(acc);
}
Update Acc2Up;
}
}
// SICS obj = new SICS();
Id batchJobId = Database.executeBatch(new SICS(),200);
Thanks
RSMI just updated your Batch job like below and also tested in org
global class SICS implements Database.Batchable<sObject>
{
global final String Query;
string q = 'Select Id, CMSIC8A__c, Temp_BadCMSIC__c from Account where Temp_BadCMSIC__c != NULL ';
global SICS()
{
Query=q;
}
global SICS(String q)
{
Query=q;
}
global Database.querylocator start(Database.BatchableContext BC)
{
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<Account> scope)
{
List <Account> Acc2Up = new List<Account>();
for(Account acc : scope)
{
/*
IF(acc.Temp_BadCMSIC__c != NULL)
{
acc.CMSIC8A__c = acc.Temp_BadCMSIC__c;
Acc2Up.add(acc);
}
*/
}
if(Acc2Up.size() > 0 )
{
Update Acc2Up;
}
}
global void finish(Database.BatchableContext BC) {
}
}
Then execute below code form your anonymous block
Let us know if this will help youId batchJobId = Database.executeBatch(new SICS(),200);