Du kan bruge Row_Number()
i din forespørgsel og bestil SubscribeId
faldende og row[0]["RowNumber"]
er totalt antal sådan her:
Select
* ,
ROW_NUMBER() OVER ( ORDER BY SubscribeId DESC) as RowNumber
From billing.BillMaster As BM
Where
( Bm.SubscribeId = '12345674' )
Order by SubscribeId
OFFSET @PageNumber * @RowCount ROWS
FETCH NEXT @RowCount ROWS ONLY;