Skip to main content

Posts

Showing posts with the label stored procedure for paging with sorting

Stored procedure for paging with sorting

CREATE PROCEDURE DataWithPagingAndSorting --Add the parameters for the stored procedure here     @insPageNo SMALLINT = 1,     @insPageSize SMALLINT = 10,     @SortType varchar(128) = 'DT', AS BEGIN     DECLARE @intTotalCount INT,             @intPageCount INT       SET NOCOUNT ON    SELECT @intTotalCount = COUNT(Id) from TableName                             SET @intPageCount = @intTotalCount/@insPageSize;                IF (@intTotalCount%@insPageSize<>0)             SET @intPageCount= @intPageCount+1         IF (@insPageNo>@intPageCount)          ...