views:

43

answers:

2

How to fetch more than 2000 records through SOQL .... Is there something query more ??? Plz help

+1  A: 

call queryMore with the queryLocator provided in the first set of results, keep calling it with the next queryLocator until the done flag is true. See the Web Services API docs for more info.

superfell
A: 

You can actually do this manually as well if you order by id and then query again with "where id > : idPrevious". If you try this just as I've typed it you'll hit a problem however, you can't use > and < with id fields. There is a simple work around for this though, just create a text type formula field which takes it's value from the id field. Then you can use that field in the query with no problems.

Of course if you're just looking to process loads of data then you might really be looking for Batch Apex.

LaceySnr

related questions