CREATEPROCEDURE[dbo].[GetUsers]--得到用户列表,注意这里的参数 @RowIndexint, @RecordCountint AS BEGIN SET NOCOUNT ON; With VUsers as ( select*,row_number() over (orderby UserID desc) as RowNum from MyUsers ) select*from VUsers where RowNum >@RowIndexand RowNum <= (@RowIndex+@RecordCount) END CREATEPROCEDURE[dbo].[GetUsersCount] AS BEGIN SET NOCOUNT ON; selectcount(UserID) from MyUsers END