By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
DECLARE @Pagesize int, @Page int;
declare @StartingRow int;
declare @EndingRow int;
if @Pagesize = 0
begin
select @StartingRow = (@PageSize * (@Page - 1));
select @EndingRow = (@StartingRow + @PageSize + 1);
end else begin
set @StartingRow = 0;
set @EndingRow = 999999;
end;
WITH ParentHierarchy AS(
SELECT 1 AS I)
SELECT I FROM ParentHierarchy;
I |
---|
1 |