March 11, 2010 at 6:02 am
I'm sure there's something glaringly obvious here that I'm just not seeing. I want to do something like the following in my where clause:
WHERE
CASE @var
WHEN 1 THEN x = 1
ELSE
NOT x = 1
END
Any pointers? I think I've developed some sort of boolean blindness today.
March 11, 2010 at 6:04 am
else x <> 1
But...you can't CASE a part of an expression:
WHERE x = CASE @var = 1 THEN 1 ELSE x END
AND x <> CASE WHEN @var <> 1 THEN 1 ELSE -999 END
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 11, 2010 at 6:59 am
Sorted. Thank you very much.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply