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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-04-12 : 09:41:42
|
| Mary writes "Is there a way to extract just the last name from a field that contains the full name? For example, my database has a field called FullName which has the customer's full name, Tom T. Jones, and I would like to extract just the last name, Jones." |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-04-12 : 09:46:06
|
| egdeclare @name varchar(100)set @name='Tom T. Jones'select substring(@name, charindex(' ',reverse(@name),1)+1,len(@name))MadhivananFailing to plan is Planning to fail |
 |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-04-12 : 10:13:31
|
Ordeclare @name varchar(100)set @name='Tom T. Jones'select Right(@name, charindex(' ',@name)+1)Srinika |
 |
|
|
|
|
|