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 |
|
tpiazza55
Posting Yak Master
162 Posts |
Posted - 2007-02-06 : 15:39:27
|
| i am makin an address block trying to make it (address1 + ' ' + address2 + ' ' + address3) as addressis there a way to get rid of the address2 if there is nothing in it |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-02-06 : 15:49:31
|
| "is there a way to get rid of the address2 if there is nothing in it"Does "nothing in it" mean it is NULL, or an Empty String?(address1 + ' ' + COALESCE(address2 + ' ', '') + address3would do for the NULL scenario, and(address1 + ' ' + COALESCE(NullIf(address2, '') + ' ', '') + address3for the "empty string" scenarioKristen |
 |
|
|
tpiazza55
Posting Yak Master
162 Posts |
Posted - 2007-02-06 : 16:10:35
|
| it could be either null or empty dependent upon whether it was entered then erased |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-02-06 : 16:40:56
|
| Please work-up a solution based my second example thenKristen |
 |
|
|
|
|
|