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 |
|
rowter
Yak Posting Veteran
76 Posts |
Posted - 2011-03-16 : 12:20:29
|
| Hi,When i use the first query, i am getting the client names. But, when i use the second query i am getting only a few names. For all the names which do not have a Middle Initial, i am not getting the client names?MI column allows NULLS.What is the difference and how to fix this issue?This is working:select (C.FirstNm + ' ' + C.LastNm ) AS ClientNm from clients as CThis is Failing. Returning only names which have MI(Middle Initialselect (C.FirstNm + ' ' + C.LastNm + ' ' + C.MI ) AS ClientNm from clients as CThanks in Advance |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2011-03-16 : 12:23:03
|
| When you concatenate strings, NULL + string = NULLselect (C.FirstNm + ' ' + ISNULL(C.LastNm,'') + ' ' + C.MI ) AS ClientNm from clients as CJimEveryday I learn something that somebody else already knew |
 |
|
|
rowter
Yak Posting Veteran
76 Posts |
Posted - 2011-03-16 : 12:26:50
|
| jimf,thanks that worked. |
 |
|
|
|
|
|