vliwill
asked on
Count the TOP n Records
Is there any way of doing a count using count(*) over that only counts the first x number of records?
Reason I ask is that a search may return 300,000 results but in reality I want to say if more than 500 returned just tell the user that. SQL is so slow at counting that I don't want it ot count the full 300,000.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect thanks
Glad to help and for the points
Raj
Raj
What like
SELECT TOP 501 COUNT(*) FROM Table WHERE .....
If you have > 501 you say > 500 results?