Answers:
Coalesce is also available in Sybase This functions evaluates the listed expressions and returns the first non-null value. If all the expressions are null, coalesce returns null USAGE: coalesce(expression, expression [, expression]...) EXAMPLE: coalesce(initialqty,finalqty,middleqty) Returns the first occurrence of a non-NULL value in either the initialqty or finalqty or middleqty
CREATE TABLE #TMP_COL( Office_phno char(12), mobile_nos char(12), home_phnos char(12)) INSERT INTO #TMP_COL VALUES ('NULL','NULL','55555') Select Coalesce (Office_phno, mobile_nos, home_phnos) as ContactNo FROM #TMP_COL Answer: ContactNo --------- NULL
Posted by: Rajesh
Contact Rajesh
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
There should not be any Spelling Mistakes.
There should not be any Gramatical Errors.
Answers must not contain any bad words.
Answers should not be the repeat of same answer, already approved.
Answer should be complete in itself.