SQL Server: CASE WHEN OR THEN ELSE END => the OR is not supported
- WHEN when_expressionIs a simple expression to which input_expression is compared when the simple CASE format is used. when_expression is any valid expression. The data types of input_expression and each when_expression must be the same or must be an implicit conversion.
- WHEN Boolean_expressionIs the Boolean expression evaluated when using the searched CASE format. Boolean_expression is any valid Boolean expression.
declare @a int,@b int
set @a=11
set @b=2
if(@a>@b)
Begin
select case when @a>1 then 1 else 2 end union select @a
End
else
begin
print @b
end
No comments:
Post a Comment