How To create Paging Data by Procedure?
=======================================
EX.
------------------------------------------------------------------
USE [demo]
GO
/****** Object: StoredProcedure [dbo].[empdatapaging] Script Date: 11/20/2013 11:54:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER proc [dbo].[empdatapaging]
@page int=1
as
begin
select * from (select row_number() over(order by first_name asc) as TableID,employee_id,last_name,first_name,salary from employee)as abcd
where TableID between ((@page-1)*3)+1 and @page*3
end
=======================================
EX.
------------------------------------------------------------------
USE [demo]
GO
/****** Object: StoredProcedure [dbo].[empdatapaging] Script Date: 11/20/2013 11:54:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER proc [dbo].[empdatapaging]
@page int=1
as
begin
select * from (select row_number() over(order by first_name asc) as TableID,employee_id,last_name,first_name,salary from employee)as abcd
where TableID between ((@page-1)*3)+1 and @page*3
end
No comments:
Post a Comment