• Since isnull(@var,1)=1 then the following code should be equivalent to the original:

    Declare @var int

    Select @var = 1+ Value1

    From (Select 1 Value1 Union All Select 1 Union All Select 2) as a

    Select @var

    But it isn't - the answer this time is 3.

    Why does the isnull function have the effect of causing the Value1 column to be summed into @var?