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 - 2006-04-03 : 17:11:05
|
| Guys,I have Name field populated with "LAWRENCE, MARY E". How can I seperate last name and first name to 'LAWRENCE' and 'MARY E'. Basically ',' is the delimiter between last name and first name.Thanks |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-04-03 : 17:46:29
|
| DECLARE @s varchar(50)SET @s = 'Kizer, Tara L'SELECT SUBSTRING(@s, 1, PATINDEX('%,%', @s) - 1), SUBSTRING(@s, PATINDEX('%,%', @s) + 2, DATALENGTH(@s))Tara Kizeraka tduggan |
 |
|
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2006-04-04 : 00:46:34
|
| This function will parse virtually any name string into component parts, or reconstruct in any desired format:http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=56499 |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-04-04 : 02:13:41
|
| orSelect Parsename(replace(@s,',','.'),2),Parsename(replace(@s,',','.'),1)MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|