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 |
|
pgmr1998
Yak Posting Veteran
66 Posts |
Posted - 2008-02-06 : 17:39:17
|
| how can I insert a constant value such as the word "NoPhone" when a field value from a select statement is null?Here is my code:select AgencyName,AgencyLoc,,ISNULL(AgencyPhone.Agency,) as phoneHow can we put in the words "nophone" when phone is null? |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2008-02-06 : 17:41:02
|
you just about had it. Did you look at the function Books Online ,ISNULL(AgencyPhone.Agency, 'nophone') as phoneBe One with the OptimizerTG |
 |
|
|
pgmr1998
Yak Posting Veteran
66 Posts |
Posted - 2008-02-06 : 17:44:17
|
| Thanks... |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-02-06 : 22:56:56
|
| Make sure your Agency field has a length of atleast 7 as ISNULL() always returns datatype of first argument. Else its better to use COALESCE here. |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2008-02-07 : 00:17:02
|
| COALESCE(COLNAME,'NOPHONE') |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|