Pages

Showing posts with label replace blank with null in sql. Show all posts
Showing posts with label replace blank with null in sql. Show all posts

Thursday, November 5, 2015

very useful functions: ISNULL and NULLIF -


this we can use when we want to replace null with your own value.

ISNULL

columnName - is null here
my value -- your custom value

select ISNULL(columnName ,'my value') as newvalue, *  from  table



--------------------------------------------------------------------------------------------



 NULLif

here function will display NULL if columnName mataches with yourValue
else it will display column's value from table

select NULLif( columnName,'yourValue') as NEWcurrencycode, * from  table