Link to home
Start Free TrialLog in
Avatar of tanj1035

asked on

SQL, how to convert the int to varchar for the null value

hi Expert,

For the column 'mtd', the content is number or null value. I want to convert null value to the varchar. Can you help me on it? Thank  you.

select d.Name,s.dealerid,
case when cast(dr.mtd as varchar) is null then 'NotActive' else mtd end as MTDDeal
from [MMD_Feed].[dbo].[SegmentID] s
inner join [MMD_Feed].[dbo].[Dealer] d on d.dealerid=s.dealerid
left join [MMD_Feed].[dbo].[dart] dr on s.dealerid=dr.dealerid
where Segment =@Segment
order by name asc
Avatar of dsacker
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial