Can I paginate a query in Sql Server without using ROW_NUM () OVER (ORDER BY xxxxx)? Can I paginate a query in Sql Server without using ROW_NUM () OVER (ORDER BY xxxxx)? oracle oracle

Can I paginate a query in Sql Server without using ROW_NUM () OVER (ORDER BY xxxxx)?


If you're writing your own data access layer, and you want to apply ROW_NUMBER() only knowing the query's output field names (rather than it's internals)...

SELECT  *FROM(  SELECT    ROW_NUMBER() OVER (ORDER BY field1, field2, field3) AS row_id,    *  FROM  (    <your-query>  )    AS unordered_data)  AS ordered_dataWHERE  row_id BETWEEN x AND y