SQLTeam.com | Weblogs | Forums

Select case Then Null


#1

Hello,

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.

#2

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


#3

So easy :slight_smile: Thank you!


#4

or:
NULLIF(capacity, 0) AS capacity