You must Sign In to post a response.
  • Category: ASP.NET

    Customizing PAging By Using SQL Server 2012

    I want implement customizing paging by using SQL Server 2012.(By using Store Procedure) In the Grid view data will bind then user can choose any page. It will show below Grid View.

    Another Requirement is Onw Drop Down List will there and user can chooose drop down list and data will bind according the paging.

    Example: In GridView First page is showing 5 no of record on one page. Then Record will show 1-5 records on First page.
    If User Choose 2 No from drop Down List then it will show 6-10 record in the Gird View.

    In Below Grid View we will take repeater for choosing the page No.
  • #756312
    Please use the below SQL script for Customizing PAging in SQL Server 2012

    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO

    ALTER PROCEDURE usp_Paging
    @PageNo int,
    @NoofRows int
    AS
    BEGIN

    SET NOCOUNT ON;
    SELECT *
    FROM [Table Name]
    ORDER BY [Column Name] OFFSET (@PageNo*@NoofRows)-@NoofRows ROWS
    FETCH NEXT @NoofRows ROWS ONLY
    END
    GO


    Refer the below links for more details

    http://www.mssqltips.com/sqlservertip/2362/overview-of-offset-and-fetch-feature-of-sql-server-2012/
    http://raresql.com/2012/07/01/sql-paging-in-sql-server-2012-using-order-by-offset-and-fetch-next/


  • Sign In to post your comments