日期:2014-05-17 浏览次数:20397 次
USE [cool]
GO
/****** 对象: StoredProcedure [dbo].[UP_ieveInfo_User] 脚本日期: 08/12/2013 14:41:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[UP_ieveInfo_User]
@page INT
, @pageSize INT
, @keywordType NVARCHAR(20) = ''
, @keyword NVARCHAR(4000) = ''
, @search2 NVARCHAR(4000) = ''
, @search4 NVARCHAR(4000) = ''
, @search5 NVARCHAR(4000) = ''
, @search6 NVARCHAR(4000) = ''
, @search7 NVARCHAR(4000) = ''
, @startPeriod NVARCHAR(20) = ''
, @endPeriod NVARCHAR(20) = ''
, @site NVARCHAR(20) = ''
AS
SET NOCOUNT ON ;
DECLARE @SQL NVARCHAR(MAX);
DECLARE @filter NVARCHAR(MAX);
SET @filter = '';
SET @page = ISNULL(@page, 1);
SET @pageSize = ISNULL(@pageSize, 10);
SET @SQL = '
WITH ALLROWS AS
(
SELECT
ROW_NUMBER() OVER (ORDER BY IU_REGDATE desc) AS ROWNUMBER
, IU_IDX
, IU_ID
, IU_SITE
, IU_NICKNAME
, IU_CASH
, ((SELECT isNull(SUM(IC_AMOUNT),0) FROM INFO_CHARGE WHERE ALLROWS.IU_ID = IC_ID and ic_status = 1) - (SELECT SUM(IE_AMOUNT) FROM INFO_EXCHANGE WHERE ALLROWS.IU_ID = IE_ID and ie_status = 1) - IU_CASH) AS TOTAL