Paging space stored procedure

zhaozj2021-02-16  77

CREATE Procedure PR_GET_EXPERT

(@PageSize Int,

@PageIndex Int,

@docount bit)

AS

Set nocount on

IF (@ docount = 1)

SELECT Count (f_id) from t_expert

Else

Begin

Declare @indextable table (id int identity (1, 1), NID INT)

Declare @PagelowerBound Int

Declare @PAGEUPPERBOUND INT

Set @pagelowerbound = (@ pageindex-1) * @ PageSize

Set @ PageUpperBound = @ PagelowerBound @ PageSize

Set rowcount @PageUpperBound

INSERT INTO @indextable (NID) SELECT F_ID from T_Expert Order by F_id DESC

Select O. * from t_expert o, @ indextable t where o.f_id = t.nid

And T.ID> @PagelowerBound and T.ID <

= @PageUpperbound Order by T.ID

end

Set nocount off

Go

转载请注明原文地址:https://www.9cbs.com/read-17691.html

New Post(0)