日期:2014-05-17 浏览次数:20510 次
ALTER PROC up_test
@orderid NVARCHAR(max),
@parakey NVARCHAR(max)
AS
SET NOCOUNT ON
DECLARE @sql nvarchar(MAX)
SET @sql = N'
SELECT SUM(CONVERT(INT, t.para_value)) ,
t.para_key
FROM ( SELECT *
FROM biz_order_para
WHERE order_id IN ({1})
) t
WHERE t.para_key IN ({2})
GROUP BY t.para_key
'
SET @sql = REPLACE(@sql, '{1}', @orderid)
SET @sql = REPLACE(@sql, '{2}', @parakey)
--print @sql
EXEC(@sql)
GO
EXEC up_test ' 2906, 2907, 2908, 2909, 2910, 2911', '''Quota'', ''Traffic'', ''DBSpace'''