Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

How we can develop database paging using PLSQL in Sql Server 2005

Author: Zunnair

In This article I will explain the way in which we can develop database paging using ROW_NUMBER() OVER keywords.

In this article i will explain database paging with Row_Number.

We have to use Row_Number() for the real databse paging implementation.

Just we call Row_Number() this method with Over key word in which we have to select all columns which wewant to use in main select statement.

Now the last not least we can use our limit variables like Start row and End row.

 

These two variables tells that from where it should start page and where it should end.

 

DECLARE @StartRow INT

DECLARE @EndRow INT

SET @StartRow = 120

SET @EndRow = 140

SELECT Col1, Col2, Col3

FROM

(

SELECT A.Col1, A.Col2, A.Col3,

ROW_NUMBER() OVER(Order BY A.Col1, A.Col2, A.Col3) AS RowNumber

FROM tblTest A

) Test

WHERE RowNumber > @StartRow AND RowNumber < @EndRow

ORDER BY Col1, Col2, Col3

 

I hope this article is easily understandable and more usable for you.

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< Implementing and Logging Error handling using PLSql in Sql Server 2005

Disclaimer - Privacy
© 2002-2017 DevASP.net