say the string (or string column) were named s, try:
substring(s, nullif(charindex('_ Part1ID = ', s),0) + 12 -- skip tag (length = 12)
, nullif(charindex('_ Part2ID = ', s),0)
- (nullif(charindex('_ Part1ID = ', s),0) + 12) )
This assumes that the Part2ID tag will never appear before Part1ID. We do nullif(charindex(...),0) so that the result will rightly be null if we don't find the tag.
If you were to create an inline function, you could be a bit more elegant:
CREATE FUNCTION dbo.fnGetPart (
@s varchar(8000), @tag1 varchar(20), @tag2 varchar(20)
) returns varchar(100) AS
BEGIN
return ( select substring(@s, i1, i2 - i1)
from ( select i1, i2 = nullif(charindex(@tag2, @s, i1),0) -- ', i1' ensures we look after @tag1
from (select i1 = nullif(charindex(@tag1, @s),0) + len(@tag1)) t ) t )
END