Retriving 10 records per page through stored procedure

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • govind161986
    New Member
    • Dec 2009
    • 21

    Retriving 10 records per page through stored procedure

    Is there a way that stored procedure retrieves only 10 records per page?

    Thanks

    Govind
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    What do you mean by "page"? Are you referring to your GUI? If you're referring to your GUI, it can be handled in different ways.

    Happy Coding!!!

    ~~ CK

    Comment

    • govind161986
      New Member
      • Dec 2009
      • 21

      #3
      I am using a stored procedure which retrieves only 10 records per page i.e., if the user is on first page the stored procedure will retrieve first 10 records and so on. But for doing this I have used a temporary table inside the stored procedure. The stored procedure first retrieves all the records and save it in a temporary table and then it retrieves 10 records at a time from the temporary table.

      Is there any other way to do this which will take less amount of time and retrieves only 10 records from database without using temporary table?

      Thanks in advance,

      Govind

      Comment

      • ck9663
        Recognized Expert Specialist
        • Jun 2007
        • 2878

        #4
        I guess when you said "page" you're talking about your GUI. The handling could vary depending on your front-end tool. What are you using?

        ~~ CK

        Comment

        • nbiswas
          New Member
          • May 2009
          • 149

          #5
          Yes. You can take the advantage of ROW_NUMBER() function(Sql server 2005+)

          Have a look

          Paging Records Using SQL Server 2005 Database - ROW_NUMBER Function

          And this too

          Paging GridView with ROW_NUMBER()

          Comment

          Working...