I just want to verify some observations I've made. I was debugging some T-SQL that was more or less like this:
IF <Condition1>SQLStatement1
ELSE IF <Condition2>
SQLStatement2
The thing is, I was only experiencing the bug when BOTH conditions were true. Both sets of statements were running. When I changed "ELSE IF <Condition2>" to just plain "ELSE" my problem was solved.
This was surprising to me, because I had expected that the ELSE IF would not execute at all in cases when IF evaluated to true. In my case, I don't need the second condition at all, but what if I wanted a series ELSE IF statements? I would have expected statements to run only on the first true condition. It appears that's not the case. Or am I misunderstanding?
Thanks!