Tech Sharing

Tech Sharing

Advertisement

ISNULL, NULLIF MsSQL function

By on May 21, 2009

I just found out this usefu function in MSSQL when I try to Google for the solution to replace the null value with something else. So that I no need to do the checking again in my application. The function is call


NULLIF and ISNULL


This 2 functions are actually work opposite with each other.

NULLIF(ColumnName, ValueToCompare) accept 2 parameters, and will return the NULL value if both the expression match.


IFNULL(ColumnName, NewValue) accept 2 parameters, the first parameters is the string that you wish you check with, and the 2nd parameter that you wish to replace with.


Comments

No Responses to “ISNULL, NULLIF MsSQL function”

Write a Comment

Captcha *

%d bloggers like this: