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.