Is there a simple built in function in sql2000 that returns 0 or 0.00 if money or a float column is null? Or do I need to build the function myself, and how would I build it? if (isnull(col1)) then 0 else col1?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, the function is called
ISNULL, you use it like this:You basically specify which value to return in case the first value is
null.Note that
ISNULLdoes not return a boolean value indicating whether the parameter isnullor not, instead you pass it 2 parameters and it does the following:null, return the value of the first argumentYou can also use the
COALESCEfunction for this, which takes an unspecified number of parameters, and returns the first non-nullargument value back, in the order they’re specified.In other words:
and
behaves the same, but I don’t know if there is a difference in “sargeability” of these two, ie. whether they can use indexes or not.