How to select data from different area of the data table RRS feed

  • Question

  • User-218090889 posted

    Hello friends,

    I have a big database that I usually select data from the data table 1 row at a time.
    I have been using the below line of code to select from TOP, that is TOP 1

     using (SqlCommand sqlCmd = new SqlCommand("SELECT TOP (1) col1, col2 FROM table1 ", con))

    but I wish to select 1 row at a time from the middle part of the data table. And also from the lower part of the data table at different time.

    Please can any one suggest very good way to achieve my objective.

    Monday, July 20, 2020 9:51 AM


  • User-218090889 posted
    I think I have found an answer to my question.
    The use of OFFSET, FETCH and ORDER BY can do what I seek.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 21, 2020 5:54 AM