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 |
|
pithhelmet
Posting Yak Master
183 Posts |
Posted - 2002-12-24 : 08:47:03
|
| Hi all -I have a varchar that has a value like this....Able, Clyde 339Able, Clyde 7Alford, James Austin 1034Berry, Roy A. 624Berry, Virgil B 882I need to get the number from the end of the string...Please advise on the best method for this...thankstony |
|
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2002-12-24 : 09:13:16
|
| If your format always has the number at the end and if there is a number there will be a space before it then here is a solution.SELECT LTRIM(RIGHT(MyStringCol,CHARINDEX ( ' ' , REVERSE(MyStringCol))))From MyTable |
 |
|
|
|
|
|