By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,413 Members | 1,594 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,413 IT Pros & Developers. It's quick & easy.

Retriving 10 records per page through stored procedure

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


Jan 28 '10 #1
Share this Question
Share on Google+
4 Replies

Expert 2.5K+
P: 2,878
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
Jan 28 '10 #2

P: 21
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,

Feb 1 '10 #3

Expert 2.5K+
P: 2,878
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
Feb 1 '10 #4

P: 149
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()
Mar 24 '10 #5

Post your reply

Sign in to post your reply or Sign up for a free account.