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 |
|
sg2255551
Constraint Violating Yak Guru
274 Posts |
Posted - 2009-08-29 : 00:50:16
|
| hiI have a table:ID Address1 Address2 Address3 Person1 demo demo null john2 street main demo KentWhen i tried using Select ID, Address1+Address2+Address3, Person from tableAIt gives me1 null John2 streetmaindemo KentWhat i want is1 demodemo John2 streetmaindemo KentHow can i still able to concatenate values even if there is a null column? Thanks |
|
|
pakko
Starting Member
6 Posts |
Posted - 2009-08-29 : 02:34:28
|
| Hi,I think ISNULL will do the job:Select ID, ISNULL(Address1,'')+ISNULL(Address2,'')+ISNULL(Address3,''), Person from tableApakko |
 |
|
|
sg2255551
Constraint Violating Yak Guru
274 Posts |
Posted - 2009-08-29 : 11:34:51
|
| Thanks. It works |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-08-31 : 02:15:40
|
| or use COALESCE instead of isnullMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|