Create Procedure [dbo].[Getall] @PageIndex INT = 1 ,@PageSize INT = 10 ,@PageCount INT OUTPUT AS BEGIN SET NOCOUNT ON; SELECT ROW_NUMBER() OVER ( ORDER BY [ID] ASC )AS RowNumber ,[CODE] ,[NAME] ,[DESCRIPTION_URL] ,[FINAL_PRICE] ,[OLD_PRICE] ,[DISCOUNT_PERCENTAGE] ,[IMAGE_URL] ,[CREATED_DATE] INTO #Results FROM AVAILABLE_OFFER DECLARE @RecordCount INT SELECT @RecordCount = COUNT(*) FROM #Results SET @PageCount = CEILING(CAST(@RecordCount AS DECIMAL(10, 2)) / CAST(@PageSize AS DECIMAL(10, 2))) PRINT @PageCount SELECT * FROM #Results WHERE RowNumber BETWEEN(@PageIndex -1) * @PageSize + 1 AND(((@PageIndex -1) * @PageSize + 1) + @PageSize) - 1 DROP TABLE #Results END
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)