Jul 26, 2003 #1 shuklix Programmer Joined Jul 15, 2003 Messages 21 Location AU Hi All, I have a query of the type select expr1 + expr2 from T either of expr1 or expr2 may be null. I get a NULL when one of them is NULL, is there a way to change it to 0 ? TIA, Saurabh
Hi All, I have a query of the type select expr1 + expr2 from T either of expr1 or expr2 may be null. I get a NULL when one of them is NULL, is there a way to change it to 0 ? TIA, Saurabh
Jul 26, 2003 #2 swampBoogie Programmer Joined Jan 6, 2003 Messages 1,660 Location SE Code: select coalesce(expr1,0) + coalesce(expr2,0) from t Upvote 0 Downvote
Jul 26, 2003 #3 TootingBoy Programmer Joined Oct 23, 2001 Messages 15 Location GB You could try using the IsNull() function. E.g. Select IsNUll(expr1,0)+ IsNull(expr2,0) If either expr1 or expr2 is null the function will return 0 (or any other value you want to use as the second parameter for the function). The path to freedom is seldom trodden by the multitude. Upvote 0 Downvote
You could try using the IsNull() function. E.g. Select IsNUll(expr1,0)+ IsNull(expr2,0) If either expr1 or expr2 is null the function will return 0 (or any other value you want to use as the second parameter for the function). The path to freedom is seldom trodden by the multitude.