sql server - T-SQL syntax to show both negative values and NULL values as 0 -


i using sql server 2014 , have query line of code:

isnull(b.[leisure],0) 'leisure' 

the value of leisure can negative, in case want value show 0.

how wrap both conditions in code?

instead of given block of code, use:

iif(b.[leisure] null or b.[leisure]<0, 0, b.[leisure]) 

or

iif(b.[leisure]>=0, b.[leisure], 0) 

Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -