Duration = isnull(FunctionA(DateA,DateB),'')
The Function above calculates number of days and if day is null it displays
the value 0 instead of blank value
How can I change the above code to so that it shows blank and not 0 for value null?
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.
If your function returns an integer the result from
isnullwill also be an integer. In the case the return value isnullyou will have an implicit conversion to integer for ” and that will be 0.Try this:
Result:
You can have the space if you first cast the return value from your function to
varchar.Result:
If your function returns
0instead ofnullyou can usenullifto get a null value before you cast tovarchar.Summary:
You need this:
or this