>>>>All in all, they're really the same thing.
>>>
>>>No, your code is not the same as Dmitry's and it doesn't test all conditions.
>>
>>How so?
>
>You're right, actually, I just realised that (wanted to update my reply, but it was too late) and made a quick test. It is indeed the same and it's better, though perhaps still not obvious and ISNULL tests would be more transparent (or some comments may help).
Did you see the second version where I combined the conditions?