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 |
|
VJG
Starting Member
17 Posts |
Posted - 2012-08-17 : 11:04:51
|
| Guys, thanks in advance,I have a field named [FirstName] in which names are stored as JOE ALLEN, VICTOR J, MARK LEE and DONALD M.I'm trying to split the name into to fields; [FirstName] and [MiddleName]substring(Firstname,1,charindex(' ', Firstname)-1) FirstName, substring(FirstName,charindex(' ', Firstname)+1,len(Firstname)) MiddleName i used the above script to split them into the two fields, but is there a way to Have it Properly formatted?Example: Id like to be have it show the results as Joe Allen, Victor J, Mark Lee and Donald M.is this possible?thanks in advance!! |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-08-17 : 11:08:45
|
| Madhivanan to the rescue here: http://beyondrelational.com/modules/2/blogs/70/posts/10901/tsql-initcap-function-convert-a-string-to-proper-case.aspx |
 |
|
|
VJG
Starting Member
17 Posts |
Posted - 2012-08-17 : 16:45:02
|
| thank you! |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|
|
|