在下面的代码段里面添加去重的 求大神帮忙
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