Popular Posts
Asynchronous and deferred JavaScript execution explained Normal execution <script> This is the default behavior of the <script> element. Parsing of the HTML code pauses while the scr... Statement.executeBatch() always returns an array of value -2 The elements in the array returned by the method executeBatch may be one of the following: A number greater than or equal to zero -- indi... vi hot key guide 第一部份:一般模式可用的按鈕說明,游標移動、複製貼上、搜尋取代等 移動游標的方法 h 或 向左方向鍵(←) 游標向左移動一個字元 j 或 向下方向鍵(↓) 游標向下移動一個字元 k 或 向上方向鍵(↑) 游標向上移動一個字元 l 或 向右方向鍵(→) 游標...
Stats
Data Paging
Sql Server 2005
DECLARE @PageIndex INT;
DECLARE @PageSize INT;
SET @PageSize = 3;
SET @PageIndex = 1;

DECLARE @StartIndex INT;
DECLARE @EndIndex INT;
SET @StartIndex = @PageSize * (@PageIndex-1) +1;
SET @EndIndex = @StartIndex + @PageSize - 1;


WITH ProductEntires AS(
    SELECT 
        ROW_NUMBER() OVER (ORDER BY [UpdateDate] DESC) AS RowIndex, 
        [ID], 
        [ProductName], 
        [ProductDescription], 
        [ProductImage1], 
        [ProductTitle1], 
        [VotedAmount] 
    FROM 
        [TblProduct] 
)

SELECT * 
FROM ProductEntires
WHERE
    [RowIndex] BETWEEN @StartIndex AND @EndIndex