Hello world.

不是什么高深算法,工作的时候套上,就用,仅此而已.

 

create PROCEDURE [dbo].[PR_GetForumFilterUserList]
(
    
@PageIndex INT=1,
    
@PageSize INT=20,
    
@numRecord INT OUT
)
 
AS 
 
BEGIN
    
SET NOCOUNT ON;

     
DECLARE @pageLowerBound INT ;  
    
DECLARE @pageUpperBound INT ;  
    
DECLARE @indextable TABLE
        (
            _id 
INT IDENTITY(11),
            
[ID] [int],
            
[UserID] [bigint] NULL,
            
[NickName] [nvarchar](50NULL,
            
[UserIP] [varchar](23NULL,
            
[Amount] [int] NULL,
            
[ThreadIDs] [varchar](maxNULL,
            
[ThreadContent] [nvarchar](maxNULL,
            
[PostTime] [datetime] NULL,
            
[type] [int] NULL
        ) ;

    
SET @pageLowerBound = ( @pageIndex - 1 ) * @pageSize ;  
    
SET @pageUpperBound = @pageLowerBound + @pageSize ; 

    
INSERT  INTO @indextable (ID, UserID, NickName, UserIP, Amount, ThreadIDs,
                 ThreadContent, PostTime, 
[type])
                 
SELECT ffu2.ID, ffu2.UserID, ffu2.NickName, ffu2.UserIP,
                        ffu2.Amount, ffu2.ThreadIDs, ffu2.ThreadContent,
                        ffu2.PostTime, ffu2.
[type]
                   
FROM qidiandb.dbo.ForumFilter_User ffu2

    
SELECT @numRecord = COUNT(*FROM @indextable;

    
SELECT ID,UserID,NickName,UserIP,Amount,ThreadIDs,ThreadContent,PostTime,[type]
        
FROM @indextable
        
WHERE _id > @pageLowerBound 
              
AND _id <= @pageUpperBound  
        
ORDER BY ID DESC;

    
RETURN @@ROWCOUNT
 
END

 

posted on 2011-06-20 13:54  Ryan.zhu  阅读(201)  评论(0编辑  收藏  举报
come soon on