• If a 'A SELECT statement that doesn't return results doesn't set a variable to anything.', then why didn't it remain at 1 when I changed the logic to 'where 1=1' ?

    if you run the following statements:

    select 'Has no value' where 1 = 0

    select 'Has value' where 1 = 1

    you will see that the first statement does not return any rows, but the second does.

    in this vein, the question posted has "where 1 = 0", which does not generate a result set, which will not change the variable's value.

    ____________________________________________
    Space, the final frontier? not any more...
    All limits henceforth are self-imposed.
    “libera tute vulgaris ex”