Retrieving Many Records in Query Analyzer

When I execute the following statement in Query Analyzer

SELECT * FROM axitem

I get a virtual-memory error message, then Query Analyzer cancels the query. The axitem table has more than 5 million records. How can I execute the query, fetch some records, wait for a few seconds, fetch the next set of records, and so on?

The easiest way to retrieve a large number of records is to use the TOP statement to filter out one set of records at a time. For details, see Itzik Ben-Gan, T-SQL Black Belt, "Over the TOP," February 2001.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.