Hi Waghmare,
Please refer below query and use according to your need
SQL
SELECT ROW_NUMBER() OVER (
ORDER BY customers.[CustomerID] ASC
) AS RowNumber
,customers.[CustomerID]
,customers.[ContactName]
,customers.[Country]
,orders.[EmployeeID]
,orders.[OrderDate]
,orders.[ShipName]
,orders.[ShipAddress]
INTO #Results
FROM [Customers] customers
INNER JOIN Orders orders
ON customers.CustomerID = orders.CustomerID
SELECT @RecordCount = COUNT(*)
FROM #Results
SELECT *
FROM #Results
WHERE RowNumber BETWEEN(@PageIndex -1) * @PageSize + 1 AND(((@PageIndex -1) * @PageSize + 1) + @PageSize) - 1
DROP TABLE #Results
Hope this works for you