1 つのストアド プロシージャを使用して、テーブルから最後の N 行を取得したい。
ストアド プロシージャには、and などのパラメータがいくつかあり@PageNumber
ます@RowCount
。
私には2つの問題があります:
I need to count the rows and results in my user interface because I want to limit my user when he is in last page and press next page.
I want my user can press last page when he is in other page.
Tip: I don't want to execute my stored procedure twice to get the results and row count because it creates dynamic and need long time for execution.
For more description I most say that my sp is like :
Create Procedure TestSelectBill
(
@PageNumber int = 1 ,
@RowCount int = 5
)
As
Begin
Select
*
From billing.BillMaster As BM
Where
( Bm.SubscribeId = '12345674' )
Order by SubscribeId
OFFSET @PageNumber * @RowCount ROWS
FETCH NEXT @RowCount ROWS ONLY;
End