I want to show the null values returned from the left outer join with a string " UnRegistered".
When the value is an integer or a bool, I just write:
ISNULL(ReturnedValue, 0) AS ReturnedValue
but how can I make it:
ISNULL(ReturnedValue, 'UnRegistered') AS ReturnedValue
I use MS SQL SERVER.
Since you need a varchar
value in the same field together with int/bool, you need to make sure every row of that field has the same data type.
Isnull(Convert(varchar(50), ReturnedValue), 'UnRegistered') AS ReturnedValue
Or you can use a CASE
as
Case when ReturnedValue is null then 'UnRegistered'
else convert(varchar(50), ReturnedValue) end as ReturnedValue