Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

converting NULL to Numeric 0

Status
Not open for further replies.

shuklix

Programmer
Jul 15, 2003
21
0
0
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
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top