How to Select the Next 20 records in SQL server?
-
Hi All, I know "TOP" Function can select the TOP n records. How can I select records from for example 20 to 50? I know SQL server doesn't have "LIMIT" Function.... Thanks Tin
-
Hi All, I know "TOP" Function can select the TOP n records. How can I select records from for example 20 to 50? I know SQL server doesn't have "LIMIT" Function.... Thanks Tin
Have a look at ROW_NUMBER[^]
The need to optimize rises from a bad design.My articles[^]
-
Have a look at ROW_NUMBER[^]
The need to optimize rises from a bad design.My articles[^]
Thanks for your reply, I able to create the row number column but when I tried to select a range of row number. It appeared this error message " Conversion failed when converting the varchar value 'Row_Number' to data type int" I have used cast and convert already. Any idea? Tin
-
Hi All, I know "TOP" Function can select the TOP n records. How can I select records from for example 20 to 50? I know SQL server doesn't have "LIMIT" Function.... Thanks Tin
Hi, what you oculd also try is something like this... SELECT top(20)* FROM _yourtable WHERE _tableID not in (select top(20) tableID from _yourtable)
-
Thanks for your reply, I able to create the row number column but when I tried to select a range of row number. It appeared this error message " Conversion failed when converting the varchar value 'Row_Number' to data type int" I have used cast and convert already. Any idea? Tin