【发布时间】:2009-12-28 11:08:03
【问题描述】:
是否可以在 SQL Server 2008 中使用一个集合,例如 (1, 2, 3, 4, 5) 作为 Sproc、函数或视图的参数?
对于这个 SLQ,我应该使用 Sproc、函数还是视图?
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
非常感谢任何帮助!
【问题讨论】:
标签: sql sql-server sql-server-2008 stored-procedures views