SQLTeam.com | Weblogs | Forums

Select case Then Null



I have a case statement in a select statement and I want it to return null when the value is 0. For example -

case when capacity = '0' then '' else capacity end as 'capacity',

  • still gives me a 0 in the results.


case when capacity = 0 then null else capacity end as capacity


So easy :slight_smile: Thank you!


NULLIF(capacity, 0) AS capacity