Jul 26, 2003 #1 shuklix Programmer Jul 15, 2003 21 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 Jan 6, 2003 1,660 SE Code: select coalesce(expr1,0) + coalesce(expr2,0) from t Upvote 0 Downvote
Jul 26, 2003 #3 TootingBoy Programmer Oct 23, 2001 15 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.