I need to know the number of records (just the count) for a query and then apply the top clause in the query to get the top selected rows. the reason for this is i need this data for pagination. so for example
Select * from Table Where a = 10
will give me 100000 rows. i need that 100000 row count information and then i want to get only top 10 records
this i need for the pagination purpose where in application side i am showing 10 of 100000 records.
Note – this i have to implement in SQL Server 2000 i want to get the output (both count and resultset) in single go. i.e i do not want to hold the resuletset in any temp table or do not want to execute the query multiple time