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 |
scelamko
Constraint Violating Yak Guru
309 Posts |
Posted - 2008-03-28 : 15:27:04
|
Guys,I have to split fullname into first name and last name - I was not able to do it substring is there any to do this?Name Fname Lname______________________________________smith, john john smithdoe, john john doeAny suggestions and inputs would helpThanks |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-03-28 : 15:47:47
|
[code]SELECT name, CASE WHEN CHARINDEX(',',Name) > 0 THEN SUBSTRING(Name,CHARINDEX(',',Name)+1,LEN(Name)-CHARINDEX(',',Name)) ELSE '' END AS Fname, CASE WHEN CHARINDEX(',',Name) > 0 THEN LEFT(Name,CHARINDEX(',',Name)-1) ELSE Name END AS LnameFROM YourTable[/code] |
 |
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2008-03-28 : 23:59:20
|
http://sqlblindman.googlepages.com/formatnamee4 d5 xd5 Nf6 |
 |
|
|
|
|
|
|