• Good question, though not the first time I have seen it.

    The explanation can be improved. What happens is that ISNULL is defined as returning the same data type as the first argument. Whereas the (otherwise mostly similar, but more portable and more flexible) alternative keyword COALESCE uses the standard rules of data type preference between all arguments passed in.


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/