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
 Extracting

Author  Topic 

kid_on_the_block
Posting Yak Master

172 Posts

Posted - 2006-03-20 : 23:38:30
Have a column with the following dataa

fname.lname
fname1.lname1

Now I need to seperate the fname & lastname into 2 different columns how to do this

please help

thanks

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-03-21 : 00:04:22
[code]select left(col, charindex('.', col) - 1), right(col, len(col) - charindex('.', col))
from
(
select 'fname.lname' as col union all
select 'fname1.lname1' as col
) c[/code]



KH

Choice is an illusion, created between those with power, and those without.
Concordantly, while your first question may be the most pertinent, you may or may not realize it is also the most irrelevant

Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2006-03-21 : 00:27:53
Something like this would work too. http://www.sqlteam.com/item.asp?ItemID=15044



Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson
Go to Top of Page
   

- Advertisement -