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 |
|
chippyles
Yak Posting Veteran
68 Posts |
Posted - 2006-06-23 : 08:04:08
|
| I am thinking this should be a simple solution. I just can't figure it out.I have a field named [Name-Chem]Example data within this field...AWS A5.23-97 for ENi1KAWS A5.23-97 for EM2EN 12070 for CrMo2I need to extract only the last section of the data.ExampleENi1KEM2CrMo2I was dabbling with the CHARINDEX to try and create a start postition. I was unsuccessful.Thanks for your help!! |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-06-23 : 08:29:57
|
| declare @s varchar(100)select @s = 'AWS A5.23-97 for ENi1K'select substring(@s, charindex(' for ', @s) + 5, len(@s))Peter LarssonHelsingborg, Sweden |
 |
|
|
chippyles
Yak Posting Veteran
68 Posts |
Posted - 2006-06-23 : 08:39:45
|
| thanks this worked great!! |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-06-23 : 08:45:22
|
| More generaldeclare @s varchar(100)select @s = 'AWS A5.23-97 for ENi1K'select right(@s,charindex(' ', reverse(@s))-1)MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|