Limit the number of rows returned on the server side (forced limit)

Posted by evolve on Stack Overflow See other posts from Stack Overflow or by evolve
Published on 2010-05-20T13:32:15Z Indexed on 2010/05/20 14:00 UTC
Read the original article Hit count: 350

So we have a piece of software which has a poorly written SQL statement which is causing every row from a table to be returned. There are several million rows in the table so this is causing serious memory issues and crashes on our clients machine. The vendor is in the process of creating a patch for the issue, however it is still a few weeks out. In the mean time we were attempting to figure out a method of limiting the number of results returned on the server side just as a temporary fix.

I have no real hope of there being a solution, I've looked around and don't really see any ways of doing this, however I'm hoping someone might have an idea.

Thank you in advance.


I forgot an important piece of information, we have no access to the source code so we can not change this on the client side where the SQL statement is formed. There is no real server side component, the client just accesses the database directly. Any solution would basically require a procedure, trigger, or some sort of SQL-Server 2008 setting/command.

© Stack Overflow or respective owner

Related posts about sql-server-2008

Related posts about sql-server