TSQL - If..Else statement inside Table-Valued Functions - cant go through

后端 未结 7 1368
情话喂你
情话喂你 2021-02-07 02:51

Before posting I have read few articles about developing USD functions, but have not encountered solutions for my problem... which is as follows:

I have a very simple da

7条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-07 03:39

    This should work.

    SELECT * FROM player 
    WHERE
      height > CASE 
                WHEN @set = 'tall' THEN 180
                WHEN @set = 'average' THEN 154
                WHEN @set = 'low' THEN 0
              END
    

    I'll leave the < case for your enjoyment.

提交回复
热议问题