Is there a way to check a CASE when it's in an array:
SELECT CASE [Option] WHEN IN (1, 3, 99) THEN 'Wrong option' ELSE 'You go!' END
Is there a way to check a CASE when it's in an array:
SELECT CASE [Option] WHEN IN (1, 3, 99) THEN 'Wrong option' ELSE 'You go!' END
SELECT CASE WHEN [Option] IN (1, 3, 99) THEN 'Wrong option' ELSE 'You go' END
You can use the CASE WHEN <predicate> THEN <value> ... END
option, rather than the CASE <value> WHEN <value> THEN <value> ... END
option.
SELECT CASE WHEN [Option] IN (1, 3, 99) THEN 'Wrong option' ELSE 'You go!' END
... but if the values are in a table, you could just do an outer join (and
CASE WHEN t.Value IS NULL THEN 'Not in list' ELSE 'In list' END
, or
CASE WHEN EXISTS (SELECT * FROM yourTable t WHERE t.value = [Option]) THEN 'Bad' ELSE 'Ok' END
...without a join.