This code is just for my reference.
declare @t table
(
idx int identity,
intColumnID int, primary key clustered( idx)
)
declare @rowcount int,
@total INT,
@return_value int
select @rowcount = (@intPageId + 5) * @intpageSize
select @intPageId = @intPageId - 1
if @intPageId < 0
select @intPageId = 1;
insert into @t
select ColumnId from [dbo].tablename where
-- Condition add all conditions here to make sure that count will b correct
select @total = @@rowcount
set rowcount @intPageSize
-- Insert statements for procedure here
SELECT * from @t t
join tablename on tablename.columnId=t.intColumnID
WHERE t.idx >= @intPageId * @intPageSize + 1
order by t.idx asc
return @total
No comments:
Post a Comment