
'select Id,name from Account '
but the following query in the code doesn't work. Any mistake in the code?
Please help!
global class BatchImpl implements Database.Batchable<sObject>
{
global Database.QueryLocator Start(Database.BatchableContext bc)
{
String sql='select Id,name from Account where CreatedDate="2016-03-29T16:02:11.000Z"';
return Database.getQueryLocator(sql);
}
global void execute(Database.BatchableContext bc, List<Account> a)
{
delete a;
}
global void finish(Database.BatchableContext bc)
{
}
}
1 answer
The issue is this :
String sql='select Id,name from Account where CreatedDate="2016-03-29T16:02:11.000Z"';
make it like
DateTime myDate = DateTime.newInstance(2016, 3, 29, 2, 11, 0);
String sql='select Id,name from Account where CreatedDate=:myDate';
Please post this to developer forum for faster response.