Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jainvinay212
Starting Member
3 Posts |
Posted - 2011-08-04 : 09:51:36
|
| I have one question why in SQL NULL treated differently..i.e NULL+ customer_id=NULL??!! |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-04 : 09:54:25
|
| because NULL is not regarded as a value under default conditions. if you want to consider NULL as a value you need to change ANSI NULL setting------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
jainvinay212
Starting Member
3 Posts |
Posted - 2011-08-04 : 09:59:49
|
| okay but it show output NULL even when customer_id is some integer value?for ex. name customer_id cash customer_id+cash john 2345 NULL Nulli am asking why i am getting NULL as logical it should be 2345?!! |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-04 : 10:03:00
|
| no operation is allowed with NULL under default conditions. if you want to get 2345 as answer you need to convert it to valid value likecustomer_id + coalesce(cash ,0)------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
jainvinay212
Starting Member
3 Posts |
Posted - 2011-08-04 : 14:40:03
|
| thank you :) i got it.. |
 |
|
|
|
|
|