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 |
|
berengar
Starting Member
21 Posts |
Posted - 2006-06-09 : 03:59:17
|
| Hi i have the following :select agent, name, surname, address, cust1_text01, cust1_text02, phone1, case call_type_id *when NULL then '' else call_type_id end as 'call_type_id' from Record_T* I have also tried when NULL then space(1) yet the query still returns NULL when this field is empty ?the idea is to always return data, even if the field is NULL toreplace it with an empty space or spaces. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-06-09 : 04:00:48
|
use isnull or coalesceselect agent, name, surname, address, cust1_text01, cust1_text02, phone1, isnull(call_type_id, '') as [Call Type ID]from Record_T KH |
 |
|
|
berengar
Starting Member
21 Posts |
Posted - 2006-06-09 : 05:03:32
|
| Cheers!!! that worked |
 |
|
|
PSamsig
Constraint Violating Yak Guru
384 Posts |
Posted - 2006-06-09 : 12:08:34
|
This would have worked too:select agent, name, surname, address, cust1_text01, cust1_text02, phone1, case when call_type_id is NULLthen ''else call_type_idend as 'call_type_id'from Record_T -- This one's tricky. You have to use calculus and imaginary numbers for this. You know, eleventeen, thirty-twelve and all those. |
 |
|
|
|
|
|
|
|