April 1, 2003 at 7:16 am
I have a field that contains data in this format: 'souph-0-97'
What I need to do is bring back just the numbers after the second hyphen. Any suggestions?
April 1, 2003 at 7:29 am
Use the REVERSE function to turn the string around, then SUBSTRING based on the position of the now first hypen and REVERSE it back:
select reverse(substring(reverse('souph-0-97'),1,charindex('-',reverse('souph-0-97'))-1))
Jeremy
April 1, 2003 at 7:36 am
Another thought, if you know that there are always 2 digits, you could use the RIGHT function:
select right('souph-0-97',2)
April 1, 2003 at 8:59 am
Jeremy,
You're right on LOL I was just returning to say that I figured it out and that was the exact solution I got...thanks though!
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply