我想使用一个包含比较运算符(如'='
, )的参数'>'
,'>='
并将其用于带有“case when then”或 if 语句的 where 子句中,如下所示:
WHERE
case @Operator
when '=' then (@Amount is null) or (@Amount = 0 ) or (Amount= @Amount)
when '>' then (@Amount is null) or (@Amount = 0 ) or (Amount> @Amount)
when '>=' then (@Amount is null) or (@Amount = 0 ) or (Amount>= @Amount)
END