• Everything that has been observed, regarding overflows, truncations, ELSE clauses executing and so on...is all documented in Books Online, under the following topics:

    SET ANSI_WARNINGS

    SET ARITHABORT

    SET ARITHIGNORE

    The various behaviours described in this thread can all be varied, and explained, by reading those references.

    The other thing is that a scalar sub-query like in the example (SELECT a FROM @tab) always returns a value - since it returns a column reference. If no rows are produced, the scalar sub-query presents a NULL.