首页 新闻 会员 周边 捐助

sql server 2008 r2去重的分页存储过程

0
悬赏园豆:10 [已关闭问题] 关闭于 2012-11-13 14:39

在下面的代码段里面添加去重的   求大神帮忙

 

 

USE [IpointsInterface]
GO
/****** Object:  StoredProcedure [dbo].[usp_OfPayGameRegion_SelectPage]    Script Date: 11/09/2012 15:52:51 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:  ouxingyu
-- Create date: 2012-11-09
-- Description: 获取游戏对象分页
-- =============================================
ALTER PROCEDURE [dbo].[usp_OfPayGameRegion_SelectPage]
 @GameName varchar(32),
 @PageSize int,
    @PageIndex int,
 @TotalCount int output
AS
BEGIN
 SET NOCOUNT ON;
    DECLARE @Start INT,@End INT
    SET @Start = (@PageIndex -1) * @PageSize+1;
    SET @End = @PageIndex *@PageSize
    -- Insert statements for procedure here
    SELECT @TotalCount = COUNT(1) FROM OfPayGameRegion(NOLOCK)
    WHERE (GameName LIKE @GameName)
   
    SELECT * FROM(
    SELECT ROW_NUMBER() OVER(ORDER BY GameID ASC) iRowNum,* FROM OfPayGameRegion(NOLOCK)
    WHERE GameName LIKE @GameName) AS [TMP]
    WHERE iRowNum BETWEEN @Start AND @End
END

呓语鑫的主页 呓语鑫 | 菜鸟二级 | 园豆:313
提问于:2012-11-09 16:22
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册