create table pages(id int,name varchar(50))
create proc insert_increment
as
begin
declare @x int
set @x=1000
while(@x<=100000)
begin
insert into pages select @x,'anil_'+cast(@x as varchar(100))
set @x=@x+1
end
end
execute insert_increment
select * from pages
create proc page_size_search(@PAGE_SIZE INT,@page_no int)
as
begin
--DECLARE @PAGE_SIZE INT,@page_no int
--SET @PAGE_SIZE=20
--set @page_no=7
SELECT * FROM pages where id between (@page_no-2)*(@page_size) and (@page_size)*(@page_no)
end
exec page_size_search 20,2
No comments:
Post a Comment