Below is the query which returns 0 when not using convert to varchar. It compares integer value

```
SELECT 
    *,
    CASE 
       WHEN Duration IS NULL
          THEN CONVERT(VARCHAR, '') 
          ELSE Duration 
    END AS Duration  
FROM
    Contribution 
WHERE 
    CreatedBy = @in_userID  AND ContentStatus = @ContentStatus   

UNION ALL

SELECT 
    *,
    CASE 
       WHEN Duration IS NULL
          THEN CONVERT(VARCHAR, '')  
          ELSE Duration 
    END AS Duration  
FROM
    Training  
WHERE 
    CreatedBy = @in_userID  AND ContentStatusValue = @TrainingStatus

```

On using union all, without using convert the case returns 0 instead ''. When using convert the problem is resolved.

Can anyone say why this happens?