mbrady5
SSCrazy
Points: 2835
More actions
June 11, 2012 at 12:42 pm
#262744
Hello, does anyone know of a way to use "IN" or something comparable in a switch statement?
Thanks
Koen Verbeeck
SSC Guru
Points: 259115
June 11, 2012 at 11:21 pm
#1499584
An "IN" statement like in TSQL can be written by a series of logical ORs.
myColumn IN (1,2,3)
equals to
myColumn == 1 OR myColumn == 2 OR myColumn == 3
Need an answer? No, you need a questionMy blog at https://sqlkover.com.MCSE Business Intelligence - Microsoft Data Platform MVP
Dave Klug
SSCertifiable
Points: 5811
June 13, 2012 at 10:09 am
#1500503
Are you looking for something like this?
SELECT
A = CASE
WHEN B IN (1,2,3) THEN 1
ELSE 0
END
...
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply