antony-688446 (4/30/2013)
I understand that 🙂 I didn't explain my example thoroughly enough - I was trying to provide an example to Tom's explanation of tri-state logic. In my example, it looks like the condition should be met, but it isn't...
I understand that too. 🙂
And I agree with the logic of your explanation.
That's why I added this there:
The comment would be correct if we put any other "run-time" command in place of DECLARE - SET, SELECT, etc.
Technically, the DECLARE isn't executed - see the other example around initialising a variable as part of the DECLARE. The statement is passed, and the variable is created, but the statement itself is NOT executed, so maybe I was correct. Depends on the definition of EXECUTED....
Well, memory is allocated, references are created, for table variable even an object created in tempdb - some actions are taken.
I'd say it's executed.
Just not on the run time but during compilation stage.
_____________
Code for TallyGenerator