sql server - Assign -1 if column has null value or blank value -


this question has answer here:

i have case if column has null value or blank value have return '-1'. have null check follows

isnull(ief.col1,'-1'). 

how can check blank value , null value(as above) @ same time. means, if column has blank value still in select -1 should returned , if null -1 should returned.

you can treat empty null nullif:

isnull(nullif(ief.leadingvalue, ''), '-1') 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -