How do I page results in SQL Server 2005?
I tried it in SQL Server 2000, but there was no reliable way to do this. I\'m now wondering if SQL Server 2005 has any buil
The accepted answer for this doesn't actually work for me...I had to jump through one more hoop to get it to work.
When I tried the answer
SELECT Row_Number() OVER(ORDER BY UserName) As RowID, UserFirstName, UserLastName
FROM Users
WHERE RowID Between 0 AND 9
it failed, complaining that it didn't know what RowID was.
I had to wrap it in an inner select like this:
SELECT *
FROM
(SELECT
Row_Number() OVER(ORDER BY UserName) As RowID, UserFirstName, UserLastName
FROM Users
) innerSelect
WHERE RowID Between 0 AND 9
and then it worked.