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 - 2005-01-13 : 07:52:31
|
| Garry writes "I have a last name field that contains data after the name such as ad-1222, ahtto. At time there is no data after the name. I want to remove everything after the name. Field could be,JohnsonJohnson AD-45445Johnson,Johnson agteeEach field should beJohnsonThanks." |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-01-13 : 07:56:27
|
| SELECT SubString(LastName, 1, PatIndex('%[^a-z]%', LastName)-1) FROM myTableLast names like St. Clair, O'Donnell, hyphenates, etc., will not work with this query though. |
 |
|
|
|
|
|