Do the strings always end with a dash, space, numeric value?
If so, using the setup from Sean, look at the code for the second column.
declare @Table table (someString varchar(25))
select 'asdf - 10' union all
select 'asdf - jeik - 10'
left(someString, len(someString) - charindex('-', REVERSE(someString)) - 1),
left(someString, patindex('%- [0-9]%', someString) - 1) -- << Here is another option
Well I thought it did.. but as it turns out today's extract has some letters in two of the rows. (W337 is one example)
This does work... but not sure if I understand how...
left( --- this is starting from the left side of the string
Len(string - Charindex -- This is taking the string and counting the total char's in the string - the place where the '-' is located.. and since you used the "Reverse" it is doing this count from the right to the left.
The "-1" at the end is cutting off the string just before it reaches the last '-' in the string.[/quote]
What can you tell us about the values at the end of the string? Are they all of the same length perhaps?