Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have lots of data in my table. I want to display first 20 rows in html table. when i click next then next 20 rows will be displayed. is there any stored procedure with two parameters, start index and end index.. and data in between both parameter will be displayed???????????
Posted
Updated 12-Jan-14 18:24pm
v2

SQL
declare @pageSize int = 20
declare @page int = 5

;with data
as
(
select row_number() over (order by modifieddate) as rowNo, salesOrderId, UnitPrice, OrderQty from Sales.salesorderdetail
)

select * from data where rowNo >= ((@page - 1) * @pageSize) and rowNo < (@page * @pageSize);


From this[^] article, which I only published today.
 
Share this answer
 
Comments
Karthik_Mahalingam 13-Jan-14 0:34am    
5! Good
 
Share this answer
 
Comments
Kim Togo 13-Jan-14 5:36am    
Okay, then use Solution 1 by Christian.
Christian Graus 13-Jan-14 17:03pm    
Wow - thanks, I did not know that. I just wrote an article, now I need to update it :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900