Connect with Expertise | Find Experts, Get Answers, Share Insights

Retriving 10 records per page through stored procedure

 
Join Date: Dec 2009
Location: Mumbai, India
Posts: 21
#1: Jan 28 '10
Is there a way that stored procedure retrieves only 10 records per page?

Thanks

Govind

ck9663's Avatar
E
C
 
Join Date: Jun 2007
Posts: 2,255
#2: Jan 28 '10

re: Retriving 10 records per page through stored procedure


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
 
Join Date: Dec 2009
Location: Mumbai, India
Posts: 21
#3: Feb 1 '10

re: Retriving 10 records per page through stored procedure


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
ck9663's Avatar
E
C
 
Join Date: Jun 2007
Posts: 2,255
#4: Feb 1 '10

re: Retriving 10 records per page through stored procedure


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
nbiswas's Avatar
C
 
Join Date: May 2009
Location: India
Posts: 123
#5: Mar 24 '10

re: Retriving 10 records per page through stored procedure


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()
Reply