• KevinBr82
  • NEWBIE
  • 5 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

Using the sample code from the Apex Language reference, I am trying to find out how many Contact records I have:

 

Integer contactCount = [SELECT COUNT() FROM Contact];

 

This raises an error "Too many query rows: 501" -- which implies that I cannot get a simple rowcount on tables with more than 500 rows. Is this true? Do I actually have to use a loop and queryMore() to find out how many rows I have in a table?

 

TIA,

 

John

  • May 05, 2009
  • Like
  • 0