Question

I can I get paging without sort condition?

I know if there is sort condition you can use

select top m_page_size * from (
     select top m_end_row_number * from (
           /*select part*/   
      ) as t_first_result
      order by m_some_row asc
)as t_second_result
order by m_some_row desc

but for some conditions there is no sort conditions in my application, so how could we use the twice top method, is there a solid column just like row_number in ORACLE for sorting?

if twice top method can not work, is there any other method for such a case?

No correct solution

OTHER TIPS

If i understood your question correctly then answer might be below:: Let me know your comments.

select top m_page_size 1,* from (
     select top m_end_row_number 1,* from (
           /*select part*/   
      ) as t_first_result
      order by 1 asc
)as t_second_result
order by 1 desc

Go through the following link, and try to use FETCH NEXT and give try.

http://technet.microsoft.com/en-us/library/gg699618.aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top