我在从存储过程中调用存储过程时弄乱了条件语句。谁能帮我吗?
CREATE PROCEDURE [dbo].[sp_Leaderboard]
@CompetitionId INTEGER
AS
DECLARE @Competition TABLE
(CompId INTEGER,
CompFormat NVARCHAR(10)
)
INSERT INTO @Competition
SELECT CompetitionId, CompetitionFormatType
FROM dbo.Competitions
LEFT JOIN dbo.CompetitionFormat ON dbo.Competitions.CompetitionFormatId = dbo.CompetitionFormat.CompetitionFormatId
WHERE CompetitionId = @CompetitionId
CASE WHEN @Competition.CompFormat = "Strokes" THEN EXEC [dbo].[sp_Strokes] ELSE EXEC [dbo].[sp_Stableford]
此外,我知道我在我的代码中没有考虑到的一点是,我还需要将参数 @CompetitionId 带入我要去的任何程序中。