I have not installed SQL Server 2005 yet (hopefully this weekend), so I have not been able to experiment yet.
One of the things I had hoped would be added to T-SQL is a way to get a range of rows out the middle of a query to populate a table, e.g. when you are showing the user page 6 of many. I had been hoping for a variation of SELECT TOP something like:
SELECT ROWS 51 TO 60 *
FROM MyTable
WHERE State = 'CA'
ORDER BY CustomerNumber
I don't see anything like that. Is there a way to do that I have not seen
Can I use RANK in the where clause to do this
My backup plan would be to do a subquery with rank in it, and put the where in the the outer query, but it seems like the same logic that returns top 10 could just as easily return a specific 10 out of the middle.
Thanks.

Can you use Rank to get rows 51 to 60 of a query?
w4t4fAk
Thanks!
It was very useful!!
sy_mbm
with t
as
(
select *, row_number() over(order by CustomerNumber) as seq
from MyTable
where State = 'CA'
)
select * from t
where seq between 51 and 60;
Performance of this query depends on your indexes/schema. Alternatively, you can select the matching rows into a temporary table with identity column and then filter on the identity value. (this is how you would do it in SQL Server 2000 also)
lasu
Matthew Owens