2009-12-28 35 views
1

是否有可能使用一組例如(1,2,3,4,5)作爲SQL Server 2008中的Sproc,函數或視圖的參數?在SQL Server 2008中使用set作爲參數來作用/ sproc?

我應該如何使用Sproc,函數或查看這個SLQ的pice?

WITH Scores AS(
    SELECT 
     ItemId, SUM(Score) AS Score 

    FROM [Presenta].[presenta].[LpivScores] 

    WHERE 
     // HERE I want (1, 2, 3, 4, 5) to be the inparameter, like @inParam 
     ListPropertyItemId IN (1, 2, 3, 4, 5) 

    GROUP BY 
     ItemId 
) 

-- I want this to be returned 
SELECT 
    i.Id, 
    s.Score 
FROM 
    Scores s, 
    Items i 
WHERE 
    s.ItemId = i.Id 

任何幫助,非常感謝!

回答

相關問題