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 |
|
mark1504
Posting Yak Master
103 Posts |
Posted - 2004-09-13 : 12:36:36
|
| The subject seems so simple that there has to be a catch, right? :-)I want to select full names including titles, where a title exists.So this...SELECT ISNULL(Title,'')+' '+Firstname+' '+Lastname FROM etcyields...Mr Joe Smith Bill JonesDr Alan Green Phil BlackWhat's the best way to eliminate the first space?ThanksMark |
|
|
DustinMichaels
Constraint Violating Yak Guru
464 Posts |
Posted - 2004-09-13 : 12:38:46
|
| SELECT CASE WHEN ISNULL(Title,'') <> '' THEN ISNULL(Title,'') +' ' ELSE '' END + Firstname+' '+Lastname |
 |
|
|
mark1504
Posting Yak Master
103 Posts |
Posted - 2004-09-13 : 13:04:35
|
| Thanks.Hey, what happened to my spaces???Bill and Phil are meant to have a space in front of them, but the forum didn't include them. |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2004-09-13 : 13:12:28
|
| ISNULL(Title + ' ','') + FirstName + ..... etc- Jeff |
 |
|
|
mark1504
Posting Yak Master
103 Posts |
Posted - 2004-09-13 : 13:19:30
|
| Yep! That'll do nicely!ThanksMark |
 |
|
|
|
|
|