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 |
|
kumar.sqldba
Starting Member
6 Posts |
Posted - 2007-08-13 : 13:45:16
|
| Hi AllHow do u make sure that a query does not return a null value?Thanks in Advance.. |
|
|
chrisrock
Starting Member
12 Posts |
Posted - 2007-08-13 : 13:46:16
|
| Depends on what you're doing but look at the isnull function in sql. http://www.sqlteam.com/article/using-isnullselect isnull(your_column_value, '') from your_tableThis will replace the null value with an empty string. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-08-14 : 01:45:04
|
quote: Originally posted by kumar.sqldba Hi AllHow do u make sure that a query does not return a null value?Thanks in Advance..
It depends on what you want to show in place of NULLMadhivananFailing to plan is Planning to fail |
 |
|
|
gator8869
Starting Member
37 Posts |
Posted - 2007-08-23 : 19:20:57
|
| MR1NEW MR2NEW (No Column Name)159-08-03 NULL 000-00-00137-03-04 NULL 000-00-00095-11-02 NULL 000-00-00079-06-91 NULL 000-00-00050-08-97 NULL 000-00-00037-12-93 NULL 000-00-00061-01-04 NULL 000-00-00186-05-04 NULL 000-00-00062-03-03 NULL 000-00-00120-06-04 NULL 000-00-00137-07-03 NULL 000-00-00113-11-70 NULL 000-00-00072-07-04 NULL 000-00-00229-03-98 NULL 000-00-00034-09-78 226-11-76 2261176229-03-98 NULL 000-00-00226-11-76 NULL 000-00-00138-06-04 NULL 000-00-00I would like to replace the NULL in MR2 With 000-00-00, and leave to not nulls Jeff |
 |
|
|
Zoroaster
Aged Yak Warrior
702 Posts |
Posted - 2007-08-23 : 19:32:33
|
| In your case, something like SELECT MR1NEW, isnull(MR2NEW, '000-00-00')For example, although I am not sure what your actual query was. -Z |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-08-23 : 19:32:47
|
quote: Originally posted by gator8869 MR1NEW MR2NEW (No Column Name)159-08-03 NULL 000-00-00137-03-04 NULL 000-00-00095-11-02 NULL 000-00-00079-06-91 NULL 000-00-00050-08-97 NULL 000-00-00037-12-93 NULL 000-00-00061-01-04 NULL 000-00-00186-05-04 NULL 000-00-00062-03-03 NULL 000-00-00120-06-04 NULL 000-00-00137-07-03 NULL 000-00-00113-11-70 NULL 000-00-00072-07-04 NULL 000-00-00229-03-98 NULL 000-00-00034-09-78 226-11-76 2261176229-03-98 NULL 000-00-00226-11-76 NULL 000-00-00138-06-04 NULL 000-00-00I would like to replace the NULL in MR2 With 000-00-00, and leave to not nulls Jeff
Stealing someone else's thread? Your question has been answered here: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=88348Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
|
|
|