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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 left(contact, charindex(contact, ' ') +9)

Author  Topic 

werhardt
Constraint Violating Yak Guru

270 Posts

Posted - 2009-12-04 : 13:50:58
We have field that contains First and Last name, is there a way we can take that information and put them into two separate columns?

Example…… Abimbola Osunkoya, we want it to just pull Abimbola. I tried just using this, left(contact, charindex(contact, ' ') +9)) but I just want it to cut off at the space between first and last name because who knows how long then next person's first name will be. Can this be done?

jhocutt
Constraint Violating Yak Guru

385 Posts

Posted - 2009-12-04 : 14:00:43
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=56499

"God does not play dice" -- Albert Einstein
"Not only does God play dice, but he sometimes throws them where they cannot be seen."
-- Stephen Hawking
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2009-12-04 : 15:36:23
Latest version is on dropbox:
http://dl.dropbox.com/u/2507186/Functions/FormatName.sql

________________________________________________
If it is not practically useful, then it is practically useless.
________________________________________________
Go to Top of Page
   

- Advertisement -