How to predict result set row count?

Posted by Saurabh Kumar on Stack Overflow See other posts from Stack Overflow or by Saurabh Kumar
Published on 2010-05-25T18:07:05Z Indexed on 2010/05/25 18:11 UTC
Read the original article Hit count: 118

Filed under:
|

I have an application where I create a big SQL query dynamically for SQL server 2008. This query is based on various search criteria which the user might give such as search by lastname, firstname, ssn etc.

The requirement is that if the user gives a condition due to which the formed query might return a lot of rows(configurable for max N rows), then the application must send back a message instead to the user saying that he needs to refine his search query as the existing query will return too many rows.

I would not want to bring back say, 5000 rows to the client and then discard that data just to show the user an error. What is an efficient way to tackle this issue?

© Stack Overflow or respective owner

Related posts about sql

Related posts about throttle