Recently I faced an scenario where ISNULL
function is returning me truncated data if the first string is null.
ISNULL(a, b);
I found the a is 5 chars and b is 10 chars but when a is null it will return only 5 chars of b and not full length.
Is this a known issue?
It is a known behaviour
From MSDN
Use
COALESCE
to over come this issueHere is a demo
Result :
Also you can use CASE WHEN with addition to @Prdp answer.