CREATE PROCEDURE [test].[proc]
@ConfiguredContentId int,
@NumberOfGames int
AS
BEGIN
SET NOCOUNT ON
RETURN
@WunNumbers TABLE (WinNumb int)
INSERT INTO @WunNumbers (WinNumb)
SELECT TOP (@NumberOfGames) WinningNumber
FROM [Game].[Game] g
JOIN [Game].[RouletteResult] AS rr ON g.[Id] = rr.[gameId]
WHERE g.[ConfiguredContentId] = @ConfiguredContentId
ORDER BY g.[Stoptime] DESC
SELECT WinNumb, COUNT (WinNumb) AS "Count"
FROM @WunNumbers wn
GROUP BY wn.[WinNumb]
END
GO
該存儲過程返回第一個select語句的值,但我想要從第二個select語句返回值。表@WunNumbers是一個臨時表。如何從存儲過程返回臨時表
任何想法???
請重新格式化您的sql代碼。 – 2009-09-18 10:22:22
該代碼不是有效的SQL。這可能是,如果「RETURN @WinNumbers」是「DECLARE @WinNumbers」,但其餘部分看起來是正確的返回我現在看到的最終結果集 – 2009-09-18 10:35:37
,我發佈了錯誤的代碼。有「DECLARE @WinNumbers」,但它仍然不起作用。 – dani 2009-09-18 10:46:49