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 |
|
a.ashabi
Posting Yak Master
117 Posts |
Posted - 2008-10-15 : 04:21:02
|
| hi.I have a field with some values like this:Nutricology/allergy Research Group Nanotek Chitosan 60 caps 32977Now Stevia Extract 8 oz. 18391Now Mung Beans 1 lb 21929I need the numbers on the last part:329771839121929thanks. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-15 : 04:23:42
|
| SELECT REVERSE(LEFT(REVERSE(col),CHARINDEX(' ',REVERSE(col))-1)) AS YourValue FROM Table |
 |
|
|
a.ashabi
Posting Yak Master
117 Posts |
Posted - 2008-10-15 : 04:35:42
|
| thank u so much for yr quick reply :) |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-10-15 : 05:06:16
|
| SimplySELECT right(col,charindex(' ',reverse(col))-1)AS YourValue FROM TableMadhivananFailing to plan is Planning to fail |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-10-15 : 05:20:21
|
SELECT RIGHT(Col, 5)FROM Table1??? E 12°55'05.63"N 56°04'39.26" |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-15 : 05:28:54
|
quote: Originally posted by Peso SELECT RIGHT(Col, 5)FROM Table1??? E 12°55'05.63"N 56°04'39.26"
Will work unless you've numbers having more than 5 digits appearing at the end. As per sample output this is fine though. |
 |
|
|
|
|
|