October 10, 2002 at 4:33 pm
I have to seperate the fname and the lname into seperate columns. Example:
This is what the data currently looks like "John Doe" I need to make it look like "John","Doe". Any ideas
Thanks
Steve Johnson
Steve Johnson
October 10, 2002 at 4:52 pm
As long as you are sure that it is only first and lastname in the data the use CHARINDEX to find ' '. Once you know the position of the ' ' you can manipulate any way you want.
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
October 10, 2002 at 5:34 pm
Something like
select substring(name,1,charindex(' ',name)), substring(name,charindex(' ',name) + 1,len(name))
Gregory Larsen, DBA
If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples
Gregory A. Larsen, MVP
October 10, 2002 at 5:39 pm
thanks guys, I got it to work...
Steve Johnson
Steve Johnson
October 11, 2002 at 2:18 am
This article shows a couple of alternative ways to do it:
http://www.sql.nu/read.asp?id=7
--
Chris Hedgate @ Apptus Technologies (http://www.apptus.se)
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply