Select a substring of data based on position

I have a column of data that contains non-uniform data.  However, I need to retrieve a substring of data that exists starting at position 20 and ends at position 24 in the string of data.  I've highlighted the substring of data that I need to get from each row.

Data Example 1:
G0010017000000000000000000    0 2

Data Example 2:
49031010000116112030026951004D00    00000000000   010 0112 A012       63701    00

So there's not much of a pattern to the data before and after the substring of data I need.
There's definitely not a pattern to the data in the substring.

How would I be able to accomplish this?  Any help would be amazing!

September 20th, 2013 4:54pm

Is this what you're looking for?  As long as the data is always between position 20 and 24, the following should work:
SELECT SUBSTRING('49031010000116112030026951004D00    00000000000   010 0112 A012       63701    00', 20, 5)

Free Windows Admin Tool Kit Click here and download it now
September 20th, 2013 5:02pm

Gah! I knew it was easier than I was making it out to be! Thank you...sometimes all it takes is a second set of eyes to look at it.
September 20th, 2013 5:06pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics