If statement SQL

后端 未结 5 553
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-14 17:58

Hi i want to run an if statement but keep getting syntax errors near all my AS aliases, what am i doing wrong?

SELECT

IF @Origin = \'ALL\'


(SELECT COUNT(*         


        
5条回答
  •  一向
    一向 (楼主)
    2021-01-14 18:16

    You forgot the BEGIN...

    IF (@Origin = 'ALL')
    BEGIN
    --
    END
    ELSE
    BEGIN
    --
    END
    

提交回复
热议问题