Hi @Luiz Lenire
This is an erroneous behavior of the function.
Actually, this is a setting of the function itself, not an error behavior. ISNULL uses the data type of the first argument.
Refer to Microsoft doc: ISNULL (Transact-SQL)
As is shown on this image, you could use COALESCE which is a syntactic shortcut for the CASE expression.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.