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

github - Git errors while pushing -

c++ - How can I delete a QSharedPointer -

php - Using grpc in Laravel, "Class 'Grpc\ChannelCredentials' not found." -