A report with just under 1 million rows doesn't really sound useful to me. I mean, no one is going to examine all those rows separately, right? And that's also the reason for the out of memory exception. To be able to continue development, you should try to make the dataset smaller. One option is using the TOP clause, such as TOP 1000.
Assuming people need to be able to analyze the data in that report, perhaps it's an idea to introduce some filters (report parameters) on the report? If you give them a default value which limits the result set to something workable, it should solve your issue.
Another path, based on your current situation, which you may possibly examine is using Excel instead of a report. If you set up a view based on your query, you can connect to it from Excel and then users can use the Excel filter functionality to analyze the data.
↧