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 |
|
chriskhan2000
Aged Yak Warrior
544 Posts |
Posted - 2005-06-22 : 09:39:14
|
I'm trying to use a CASE statement in my SP, but I can't seem to get it to work correctly. What I want to do is that when the User Defined Field which is use for phone extension is empty or Null, then just return the phone field, else return the phone and extension.CASE QUOTE.USER_8 WHEN NULL THEN CONTACT_PHONE ELSE CONTACT_PHONE + ' ' + QUOTE.USER_8 END AS PHONE The query works, but does not pull the phone numbers (CONTACT_PHONE) when User Defined Field 8 has "NULL" in there. Only returns when it has empty field like " ". Any ideas? |
|
|
dsdeming
479 Posts |
Posted - 2005-06-22 : 09:42:30
|
| Try this:CASE WHEN QUOTE.USER_8 IS NULL THEN CONTACT_PHONE ELSE CONTACT_PHONE + ' ' + QUOTE.USER_8 END AS PHONEDennis |
 |
|
|
chriskhan2000
Aged Yak Warrior
544 Posts |
Posted - 2005-06-22 : 10:14:07
|
| Awesome!!! Switching that around works. |
 |
|
|
|
|
|